]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/monitoring/default.nix
Use attrs for secrets instead of lists
[perso/Immae/Config/Nix.git] / modules / private / monitoring / default.nix
index f00fb7c33c38a09f57e0f1a415d10c86006dcbb0..bdb5c93183d67bd4fa05e1b8cb10f3ceeaf27e09 100644 (file)
@@ -27,7 +27,7 @@ let
       interface = "eth0";
     };
     eldiron = {
-      processWarn = "250"; processAlert = "400";
+      processWarn = "550"; processAlert = "650";
       loadWarn = "1.0"; loadAlert = "1.2";
       interface = "eth0";
     };
@@ -199,18 +199,15 @@ in
       text = "MAILADDR ${config.myEnv.monitoring.email}";
     };
 
-    secrets.keys = [
-      {
-        dest = "naemon/id_rsa";
+    secrets.keys = {
+      "naemon/id_rsa" = {
         user = "naemon";
         group = "naemon";
         permissions = "0400";
         text = config.myEnv.monitoring.ssh_secret_key;
-      }
-    ] ++ lib.optionals cfg.master (
-      lib.mapAttrsToList (k: v:
-      {
-        dest = "${k}_access_key";
+      };
+    } // lib.optionalAttrs cfg.master (
+      lib.mapAttrs' (k: v: lib.nameValuePair "${k}_access_key" {
         user = "naemon";
         group = "naemon";
         permissions = "0400";
@@ -238,7 +235,7 @@ in
         broker_module=${pkgs.status_engine.module}/lib/status-engine/naemon/statusengine-${pkgs.naemon.status_engine_version}.o use_service_perfdata=1 use_process_data=0 use_system_command_data=0 use_external_command_data=0 use_flapping_data=0 use_program_status_data=0 use_notification_data=0 use_contact_status_data=0 use_contact_notification_data=0 use_event_handler_data=0 use_object_data=0
       '';
       extraResource = let
-        resources = lib.mapAttrsToList (k: v: v.resources or {}) mypluginsConfig;
+        resources = [hostObjects.resources or {}] ++ (lib.mapAttrsToList (k: v: v.resources or {}) mypluginsConfig);
         joined = lib.zipAttrsWith (n: v: if builtins.length (lib.unique v) == 1 then builtins.head v else abort "Non-unique resources names") resources;
         joinedStr = builtins.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "$" + "${k}$=${v}") joined);
       in ''