X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fprivate%2Fmonitoring%2Fobjects_backup-2.nix;h=a930a7d7884fa24e7a482db7330e414305b8aec6;hb=acab8301f6a0a76d97b36d009a60d4172bf62981;hp=c302e453f08663f74fa26514beb688074e9bc914;hpb=6015a3b52c3b155ac444aeb39950c38a5e653101;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/private/monitoring/objects_backup-2.nix b/modules/private/monitoring/objects_backup-2.nix index c302e45..a930a7d 100644 --- a/modules/private/monitoring/objects_backup-2.nix +++ b/modules/private/monitoring/objects_backup-2.nix @@ -1,50 +1,111 @@ -{ ... }: +{ config, pkgs, lib, hostFQDN, emailCheck, ... }: +let + defaultPassiveInfo = { + filter = lib.attrsets.filterAttrs + (k: v: builtins.elem k ["service_description"] || builtins.substring 0 1 k == "_"); + use = "external-passive-service"; + freshness_threshold = "450"; + retry_interval = "1"; + servicegroups = "webstatus-resources"; + host_name = hostFQDN; + }; +in { + activatedPlugins = [ "file_date" "mysql" "openldap" "redis" "emails" ]; service = [ + (emailCheck "backup-2" hostFQDN // { + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-email"; freshness_threshold = "1350"; }; + }) { + passiveInfo = defaultPassiveInfo; service_description = "Size on /backup2 partition"; use = "local-service"; check_command = ["check_local_disk" "10%" "5%" "/backup2"]; } { + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; }; service_description = "Last backup in /backup2/phare is not too old"; use = "local-service"; check_command = ["check_last_file_date" "/backup2/phare" "14" "backup"]; } { - service_description = "Last backup in /backup2/immae_eu is not too old"; + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; }; + service_description = "Last backup in /backup2/dilion is not too old"; use = "local-service"; - check_command = ["check_last_file_date" "/backup2/immae_eu" "14" "backup"]; + check_command = ["check_last_file_date" "/backup2/dilion" "14" "backup"]; } { - service_description = "Last backup in /backup2/immae_fr is not too old"; + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-backup"; }; + service_description = "Last backup in /backup2/ulminfo is not too old"; use = "local-service"; - check_command = ["check_last_file_date" "/backup2/immae_fr" "14" "backup"]; + check_command = ["check_last_file_date" "/backup2/ulminfo" "14" "backup"]; } { + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; }; service_description = "Last postgresql dump in /backup2/eldiron/postgresql_backup is not too old"; use = "local-service"; check_command = ["check_last_file_date" "/backup2/eldiron/postgresql_backup" "7" "postgres"]; } { + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; }; service_description = "Redis replication for eldiron is up to date"; use = "local-service"; check_command = ["check_redis_replication" "/run/redis_eldiron/redis.sock"]; } { + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; }; service_description = "Last redis dump in /backup2/eldiron/redis_backup is not too old"; use = "local-service"; check_command = ["check_last_file_date" "/backup2/eldiron/redis_backup" "7" "redis"]; } { + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; }; service_description = "Mysql replication for eldiron is up to date"; use = "local-service"; check_command = ["check_mysql_replication" "/run/mysqld_eldiron/mysqld.sock" "/var/secrets/mysql_replication/eldiron/client"]; } { + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; }; service_description = "Last mysql dump in /backup2/eldiron/mysql_backup is not too old"; use = "local-service"; check_command = ["check_last_file_date" "/backup2/eldiron/mysql_backup" "7" "mysql"]; } + { + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases"; }; + service_description = "Openldap replication for eldiron is up to date"; + use = "local-service"; + check_command = let + name = "eldiron"; + hcfg = config.myServices.databasesReplication.openldap.hosts.eldiron; + base = config.myServices.databasesReplication.openldap.base; + eldiron_schemas = pkgs.callPackage ../databases/openldap/eldiron_schemas.nix {}; + ldapConfig = pkgs.writeText "slapd.conf" '' + include ${pkgs.openldap}/etc/schema/core.schema + include ${pkgs.openldap}/etc/schema/cosine.schema + include ${pkgs.openldap}/etc/schema/inetorgperson.schema + include ${pkgs.openldap}/etc/schema/nis.schema + ${eldiron_schemas} + moduleload back_hdb + backend hdb + database hdb + + suffix "${hcfg.base}" + directory ${base}/${name}/openldap + ''; + in [ + "check_openldap_replication" + hcfg.url + hcfg.dn + "${config.secrets.location}/openldap_replication/eldiron/replication_password" + hcfg.base + ldapConfig + ]; + } + { + passiveInfo = defaultPassiveInfo // { servicegroups = "webstatus-databases,webstatus-backup"; }; + service_description = "Last openldap dump in /backup2/eldiron/openldap_backup is not too old"; + use = "local-service"; + check_command = ["check_last_file_date" "/backup2/eldiron/openldap_backup" "7" "openldap"]; + } ]; }