about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorAstro <astro@spaceboyz.net>2019-10-17 21:40:57 +0200
committerAstro <astro@spaceboyz.net>2019-10-20 00:53:49 +0200
commite2283d95336f5e495c0dec11a9eff6f52380e3a6 (patch)
treef5a52b81d791c2756c1d965a0efa7c9f507abcd7 /nixos/modules/services
parentabf263fed7870e3b8cc6ecc115d778aad595ab89 (diff)
downloadnixlib-e2283d95336f5e495c0dec11a9eff6f52380e3a6.tar
nixlib-e2283d95336f5e495c0dec11a9eff6f52380e3a6.tar.gz
nixlib-e2283d95336f5e495c0dec11a9eff6f52380e3a6.tar.bz2
nixlib-e2283d95336f5e495c0dec11a9eff6f52380e3a6.tar.lz
nixlib-e2283d95336f5e495c0dec11a9eff6f52380e3a6.tar.xz
nixlib-e2283d95336f5e495c0dec11a9eff6f52380e3a6.tar.zst
nixlib-e2283d95336f5e495c0dec11a9eff6f52380e3a6.zip
nixos/collectd: add plugin config
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/monitoring/collectd.nix18
1 files changed, 17 insertions, 1 deletions
diff --git a/nixos/modules/services/monitoring/collectd.nix b/nixos/modules/services/monitoring/collectd.nix
index 6a4c678eb21f..3d672613296f 100644
--- a/nixos/modules/services/monitoring/collectd.nix
+++ b/nixos/modules/services/monitoring/collectd.nix
@@ -16,8 +16,15 @@ let
       NotifyLevel "OKAY"
     </Plugin>
 
+    ${concatStrings (mapAttrsToList (plugin: pluginConfig: ''
+      LoadPlugin ${plugin}
+      <Plugin "${plugin}">
+      ${pluginConfig}
+      </Plugin>
+    '') cfg.plugins)}
+
     ${concatMapStrings (f: ''
-    Include "${f}"
+      Include "${f}"
     '') cfg.include}
 
     ${cfg.extraConfig}
@@ -68,6 +75,15 @@ in {
       type = listOf str;
     };
 
+    plugins = mkOption {
+      default = {};
+      example = { cpu = ""; memory = ""; network = "Server 192.168.1.1 25826"; };
+      description = ''
+        Attribute set of plugin names to plugin config segments
+      '';
+      type = types.attrsOf types.str;
+    };
+
     extraConfig = mkOption {
       default = "";
       description = ''