diff options
author | Ben Kelly <bk@ancilla.ca> | 2018-12-13 18:16:07 -0500 |
---|---|---|
committer | Ben Kelly <btk@google.com> | 2019-02-04 20:17:26 -0500 |
commit | 0c3208a8e462c95a1deeb5bd7ab3c467ff2eec49 (patch) | |
tree | b68635dd43acccab4a9ea12e5a0b9595bd3f1187 | |
parent | c74abf763af37fd453a2dd5aa8390da8256e4f8e (diff) | |
download | nixpkgs-0c3208a8e462c95a1deeb5bd7ab3c467ff2eec49.tar nixpkgs-0c3208a8e462c95a1deeb5bd7ab3c467ff2eec49.tar.gz nixpkgs-0c3208a8e462c95a1deeb5bd7ab3c467ff2eec49.tar.bz2 nixpkgs-0c3208a8e462c95a1deeb5bd7ab3c467ff2eec49.tar.lz nixpkgs-0c3208a8e462c95a1deeb5bd7ab3c467ff2eec49.tar.xz nixpkgs-0c3208a8e462c95a1deeb5bd7ab3c467ff2eec49.tar.zst nixpkgs-0c3208a8e462c95a1deeb5bd7ab3c467ff2eec49.zip |
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.
-rw-r--r-- | nixos/modules/services/monitoring/munin.nix | 21 | ||||
-rw-r--r-- | 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 + <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}"; 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; |