From 46a61a1b237b5b676cf0821bf65932d86cfe67b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 15 Jul 2020 16:56:35 +0200 Subject: Add monitoring for tiboqorl --- modules/private/monitoring/default.nix | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'modules/private/monitoring/default.nix') diff --git a/modules/private/monitoring/default.nix b/modules/private/monitoring/default.nix index 8f8b6c0..d5bf7fb 100644 --- a/modules/private/monitoring/default.nix +++ b/modules/private/monitoring/default.nix @@ -92,19 +92,24 @@ let interface = "ens3"; }; }; + externalObjects = lib.genAttrs [ "tiboqorl-fr" ] + (n: pkgs.callPackage (./. + "/objects_" + n + ".nix") { inherit emailCheck; }); masterPassiveObjects = let passiveNodes = lib.attrsets.filterAttrs (n: _: builtins.elem n ["backup-2" "eldiron"]) nodes; toPassiveServices = map (s: s.passiveInfo.filter s // s.passiveInfo); passiveServices = lib.flatten (lib.attrsets.mapAttrsToList (_: n: toPassiveServices n.config.myServices.monitoring.services) passiveNodes - ); + ) ++ lib.flatten (lib.attrsets.mapAttrsToList + (_: n: toPassiveServices n.service) + externalObjects); in { service = passiveServices; host = lib.lists.foldr (a: b: a//b) {} - (lib.attrsets.mapAttrsToList (_: h: h.config.myServices.monitoring.hosts) passiveNodes); + (lib.attrsets.mapAttrsToList (_: h: h.config.myServices.monitoring.hosts) passiveNodes + ++ lib.attrsets.mapAttrsToList (_: n: n.host) externalObjects); }; emailCheck = host: hostFQDN: let allCfg = config.myEnv.monitoring.email_check; @@ -130,7 +135,7 @@ let }; otherObjects = map (n: (pkgs.callPackage (./. + "/objects_" + n + ".nix") { inherit emailCheck; })) - [ "caldance-1" "ulminfo-fr" "phare" "tiboqorl-fr" ]; + [ "caldance-1" "ulminfo-fr" "phare" ]; masterObjects = pkgs.callPackage ./objects_master.nix { inherit config; }; commonObjects = pkgs.callPackage ./objects_common.nix ({ master = cfg.master; @@ -149,6 +154,9 @@ let hostFQDN = config.hostEnv.fqdn; hostName = name; }); + objectsFiles = lib.mapAttrs' (name: value: lib.nameValuePair + "=/${name}/objects.conf" { alias = pkgs.writeText "objects.conf" (toObjects value); } + ) externalObjects; in { options = { @@ -181,6 +189,10 @@ in }; config = lib.mkIf cfg.enable { + services.nginx = lib.mkIf config.myServices.status.enable { + virtualHosts."status.immae.eu".locations = objectsFiles; + }; + services.duplyBackup.profiles.monitoring = { rootDir = config.services.naemon.varDir; }; -- cgit v1.2.3