From 0c3208a8e462c95a1deeb5bd7ab3c467ff2eec49 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Thu, 13 Dec 2018 18:16:07 -0500 Subject: nixos/munin: add disabledPlugins option This is just a set of globs to remove from the active plugins directory after autoconfiguration is complete. I also removed the hard-coded disabling of "diskstats", since it seems to work just fine now. --- nixos/modules/services/monitoring/munin.nix | 21 +++++++++++++++++++-- nixos/tests/munin.nix | 4 +--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/monitoring/munin.nix b/nixos/modules/services/monitoring/munin.nix index 47ccf9b0a34..dcdad6fac1b 100644 --- a/nixos/modules/services/monitoring/munin.nix +++ b/nixos/modules/services/monitoring/munin.nix @@ -115,6 +115,17 @@ in ''; }; + disabledPlugins = mkOption { + default = []; + type = with types; listOf string; + description = '' + Munin plugins to disable, even if + munin-node-configure --suggest tries to enable + them. To disable a wildcard plugin, use an actual wildcard, as in + the example. + ''; + example = [ "diskstats" "zfs_usage_*" ]; + }; }; services.munin-cron = { @@ -191,10 +202,16 @@ in mkdir -p /etc/munin/plugins rm -rf /etc/munin/plugins/* + + # Autoconfigure builtin plugins ${pkgs.munin}/bin/munin-node-configure --suggest --shell --families contrib,auto,manual --config ${nodeConf} --libdir=${pkgs.munin}/lib/plugins --servicedir=/etc/munin/plugins --sconfdir=${pluginConfDir} 2>/dev/null | ${pkgs.bash}/bin/bash - # NOTE: we disable disktstats because plugin seems to fail and it hangs html generation (100% CPU + memory leak) - rm /etc/munin/plugins/diskstats || true + + ${lib.optionalString (nodeCfg.disabledPlugins != []) '' + # Disable plugins + cd /etc/munin/plugins + rm -f ${toString nodeCfg.disabledPlugins} + ''} ''; serviceConfig = { ExecStart = "${pkgs.munin}/sbin/munin-node --config ${nodeConf} --servicedir /etc/munin/plugins/ --sconfdir=${pluginConfDir}"; diff --git a/nixos/tests/munin.nix b/nixos/tests/munin.nix index 9f66005292a..95cecf17b8c 100644 --- a/nixos/tests/munin.nix +++ b/nixos/tests/munin.nix @@ -15,9 +15,7 @@ import ./make-test.nix ({ pkgs, ...} : { munin-node = { enable = true; # disable a failing plugin to prevent irrelevant error message, see #23049 - extraConfig = '' - ignore_file ^apc_nis$ - ''; + disabledPlugins = [ "apc_nis" ]; }; munin-cron = { enable = true; -- cgit 1.4.1