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.
This commit is contained in:
Ben Kelly 2018-12-13 18:16:07 -05:00 committed by Ben Kelly
parent c74abf763a
commit 0c3208a8e4
2 changed files with 20 additions and 5 deletions

View File

@ -115,6 +115,17 @@ in
'';
};
disabledPlugins = mkOption {
default = [];
type = with types; listOf string;
description = ''
Munin plugins to disable, even if
<literal>munin-node-configure --suggest</literal> 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}";

View File

@ -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;