From e2283d95336f5e495c0dec11a9eff6f52380e3a6 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 17 Oct 2019 21:40:57 +0200 Subject: [PATCH] nixos/collectd: add plugin config --- nixos/modules/services/monitoring/collectd.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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" + ${concatStrings (mapAttrsToList (plugin: pluginConfig: '' + LoadPlugin ${plugin} + + ${pluginConfig} + + '') 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 = ''