monitoring: move dashboards into related modules

This commit is contained in:
ibizaman 2026-01-21 21:09:08 +01:00
parent 5f82a56f76
commit c9c5f52238
11 changed files with 71 additions and 6 deletions

View file

@ -431,6 +431,9 @@
"blocks-borgbackup-options-shb.borgbackup.databases._name_.settings.stateDir": [ "blocks-borgbackup-options-shb.borgbackup.databases._name_.settings.stateDir": [
"blocks-borgbackup.html#blocks-borgbackup-options-shb.borgbackup.databases._name_.settings.stateDir" "blocks-borgbackup.html#blocks-borgbackup-options-shb.borgbackup.databases._name_.settings.stateDir"
], ],
"blocks-borgbackup-options-shb.borgbackup.enableDashboard": [
"blocks-borgbackup.html#blocks-borgbackup-options-shb.borgbackup.enableDashboard"
],
"blocks-borgbackup-options-shb.borgbackup.instances": [ "blocks-borgbackup-options-shb.borgbackup.instances": [
"blocks-borgbackup.html#blocks-borgbackup-options-shb.borgbackup.instances" "blocks-borgbackup.html#blocks-borgbackup-options-shb.borgbackup.instances"
], ],
@ -950,6 +953,9 @@
"blocks-monitoring-options-shb.monitoring.contactPoints": [ "blocks-monitoring-options-shb.monitoring.contactPoints": [
"blocks-monitoring.html#blocks-monitoring-options-shb.monitoring.contactPoints" "blocks-monitoring.html#blocks-monitoring-options-shb.monitoring.contactPoints"
], ],
"blocks-monitoring-options-shb.monitoring.dashboards": [
"blocks-monitoring.html#blocks-monitoring-options-shb.monitoring.dashboards"
],
"blocks-monitoring-options-shb.monitoring.debugLog": [ "blocks-monitoring-options-shb.monitoring.debugLog": [
"blocks-monitoring.html#blocks-monitoring-options-shb.monitoring.debugLog" "blocks-monitoring.html#blocks-monitoring-options-shb.monitoring.debugLog"
], ],
@ -1376,6 +1382,9 @@
"blocks-restic-options-shb.restic.databases._name_.settings.retention": [ "blocks-restic-options-shb.restic.databases._name_.settings.retention": [
"blocks-restic.html#blocks-restic-options-shb.restic.databases._name_.settings.retention" "blocks-restic.html#blocks-restic-options-shb.restic.databases._name_.settings.retention"
], ],
"blocks-restic-options-shb.restic.enableDashboard": [
"blocks-restic.html#blocks-restic-options-shb.restic.enableDashboard"
],
"blocks-restic-options-shb.restic.instances": [ "blocks-restic-options-shb.restic.instances": [
"blocks-restic.html#blocks-restic-options-shb.restic.instances" "blocks-restic.html#blocks-restic-options-shb.restic.instances"
], ],
@ -1661,6 +1670,9 @@
"blocks-ssl-options-shb.certs.certs.selfsigned._name_.systemdService": [ "blocks-ssl-options-shb.certs.certs.selfsigned._name_.systemdService": [
"blocks-ssl.html#blocks-ssl-options-shb.certs.certs.selfsigned._name_.systemdService" "blocks-ssl.html#blocks-ssl-options-shb.certs.certs.selfsigned._name_.systemdService"
], ],
"blocks-ssl-options-shb.certs.enableDashboard": [
"blocks-ssl.html#blocks-ssl-options-shb.certs.enableDashboard"
],
"blocks-ssl-options-shb.certs.systemdService": [ "blocks-ssl-options-shb.certs.systemdService": [
"blocks-ssl.html#blocks-ssl-options-shb.certs.systemdService" "blocks-ssl.html#blocks-ssl-options-shb.certs.systemdService"
], ],
@ -4535,6 +4547,9 @@
"services-nextcloudserver-options-shb.nextcloud.enable": [ "services-nextcloudserver-options-shb.nextcloud.enable": [
"services-nextcloud.html#services-nextcloudserver-options-shb.nextcloud.enable" "services-nextcloud.html#services-nextcloudserver-options-shb.nextcloud.enable"
], ],
"services-nextcloudserver-options-shb.nextcloud.enableDashboard": [
"services-nextcloud.html#services-nextcloudserver-options-shb.nextcloud.enableDashboard"
],
"services-nextcloudserver-options-shb.nextcloud.externalFqdn": [ "services-nextcloudserver-options-shb.nextcloud.externalFqdn": [
"services-nextcloud.html#services-nextcloudserver-options-shb.nextcloud.externalFqdn" "services-nextcloud.html#services-nextcloudserver-options-shb.nextcloud.externalFqdn"
], ],

View file

@ -158,9 +158,14 @@ in
{ {
imports = [ imports = [
../../lib/module.nix ../../lib/module.nix
../blocks/monitoring.nix
]; ];
options.shb.borgbackup = { options.shb.borgbackup = {
enableDashboard = lib.mkEnableOption "the Backups SHB dashboard" // {
default = true;
};
instances = mkOption { instances = mkOption {
description = "Files to backup following the [backup contract](./shb.contracts-backup.html)."; description = "Files to backup following the [backup contract](./shb.contracts-backup.html).";
default = { }; default = { };
@ -525,6 +530,12 @@ in
in in
flatten (mapAttrsToList mkBorgBackupBinary cfg.databases); flatten (mapAttrsToList mkBorgBackupBinary cfg.databases);
} }
(lib.mkIf (cfg.enableDashboard && (cfg.instances != { } || cfg.databases != { })) {
shb.monitoring.dashboards = [
./backup/dashboard/Backups.json
];
})
] ]
); );
} }

View file

@ -306,13 +306,9 @@ in
(lib.mkIf cfg.enable { (lib.mkIf cfg.enable {
shb.monitoring.dashboards = [ shb.monitoring.dashboards = [
./monitoring/dashboards/Backups.json
./monitoring/dashboards/Errors.json ./monitoring/dashboards/Errors.json
./monitoring/dashboards/Nextcloud.json
./monitoring/dashboards/Performance.json ./monitoring/dashboards/Performance.json
./monitoring/dashboards/Scraping_Jobs.json ./monitoring/dashboards/Scraping_Jobs.json
./monitoring/dashboards/SSL.json
./monitoring/dashboards/Torrents.json
]; ];
services.grafana.provision = { services.grafana.provision = {

View file

@ -149,9 +149,14 @@ in
{ {
imports = [ imports = [
../../lib/module.nix ../../lib/module.nix
../blocks/monitoring.nix
]; ];
options.shb.restic = { options.shb.restic = {
enableDashboard = lib.mkEnableOption "the Backups SHB dashboard" // {
default = true;
};
instances = mkOption { instances = mkOption {
description = "Files to backup following the [backup contract](./shb.contracts-backup.html)."; description = "Files to backup following the [backup contract](./shb.contracts-backup.html).";
default = { }; default = { };
@ -506,6 +511,12 @@ in
in in
flatten (mapAttrsToList mkResticBinary cfg.databases); flatten (mapAttrsToList mkResticBinary cfg.databases);
} }
(lib.mkIf (cfg.enableDashboard && (cfg.instances != { } || cfg.databases != { })) {
shb.monitoring.dashboards = [
./backup/dashboard/Backups.json
];
})
] ]
); );
} }

View file

@ -21,6 +21,7 @@ in
{ {
imports = [ imports = [
../../lib/module.nix ../../lib/module.nix
./monitoring.nix
]; ];
options.shb.certs = { options.shb.certs = {
@ -31,6 +32,9 @@ in
type = lib.types.str; type = lib.types.str;
default = "shb-ca-bundle.service"; default = "shb-ca-bundle.service";
}; };
enableDashboard = lib.mkEnableOption "the SSL SHB dashboard" // {
default = true;
};
cas.selfsigned = lib.mkOption { cas.selfsigned = lib.mkOption {
description = "Generate a self-signed Certificate Authority."; description = "Generate a self-signed Certificate Authority.";
default = { }; default = { };
@ -662,5 +666,10 @@ in
in in
optionals (cfg.certs.letsencrypt != { }) (flatten (mapAttrsToList scrapeCfg cfg.certs.letsencrypt)); optionals (cfg.certs.letsencrypt != { }) (flatten (mapAttrsToList scrapeCfg cfg.certs.letsencrypt));
} }
(lib.mkIf (cfg.enableDashboard && (cfg.certs.selfsigned != { } || cfg.certs.letsencrypt != { })) {
shb.monitoring.dashboards = [
./ssl/dashboard/SSL.json
];
})
]; ];
} }

View file

@ -30,10 +30,15 @@ in
imports = [ imports = [
../../lib/module.nix ../../lib/module.nix
../blocks/nginx.nix ../blocks/nginx.nix
../blocks/monitoring.nix
]; ];
options.shb.deluge = { options.shb.deluge = {
enable = lib.mkEnableOption "selfhostblocks.deluge"; enable = lib.mkEnableOption "the SHB Deluge service";
enableDashboard = lib.mkEnableOption "the Torrents SHB dashboard" // {
default = true;
};
subdomain = lib.mkOption { subdomain = lib.mkOption {
type = lib.types.str; type = lib.types.str;
@ -452,6 +457,12 @@ in
} }
]; ];
}) })
(lib.mkIf (cfg.enable && cfg.enableDashboard) {
shb.monitoring.dashboards = [
./deluge/dashboard/Torrents.json
];
})
] ]
); );
} }

View file

@ -28,10 +28,16 @@ in
{ {
imports = [ imports = [
../../lib/module.nix ../../lib/module.nix
../blocks/authelia.nix
../blocks/monitoring.nix
]; ];
options.shb.nextcloud = { options.shb.nextcloud = {
enable = lib.mkEnableOption "selfhostblocks.nextcloud-server"; enable = lib.mkEnableOption "the SHB Nextcloud service";
enableDashboard = lib.mkEnableOption "the Nextcloud SHB dashboard" // {
default = true;
};
subdomain = lib.mkOption { subdomain = lib.mkOption {
type = lib.types.str; type = lib.types.str;
@ -1347,5 +1353,11 @@ in
''; '';
} }
)) ))
(lib.mkIf (cfg.enable && cfg.enableDashboard) {
shb.monitoring.dashboards = [
./nextcloud-server/dashboard/Nextcloud.json
];
})
]; ];
} }