diff --git a/nixos/modules/services/monitoring/munin.nix b/nixos/modules/services/monitoring/munin.nix index fea52fa56081..c2299cfefef8 100644 --- a/nixos/modules/services/monitoring/munin.nix +++ b/nixos/modules/services/monitoring/munin.nix @@ -195,10 +195,9 @@ in system.activationScripts.munin-node = '' echo "updating munin plugins..." - export PATH="/run/current-system/sw/bin:/run/current-system/sw/sbin"; mkdir -p /etc/munin/plugins rm -rf /etc/munin/plugins/* - ${pkgs.munin}/sbin/munin-node-configure --shell --families contrib,auto,manual --config ${nodeConf} --libdir=${muninPlugins} --servicedir=/etc/munin/plugins 2>/dev/null | ${pkgs.bash}/bin/bash + PATH="/run/current-system/sw/bin:/run/current-system/sw/sbin" ${pkgs.munin}/sbin/munin-node-configure --shell --families contrib,auto,manual --config ${nodeConf} --libdir=${muninPlugins} --servicedir=/etc/munin/plugins 2>/dev/null | ${pkgs.bash}/bin/bash ''; }) (mkIf cronCfg.enable { diff --git a/nixos/tests/default.nix b/nixos/tests/default.nix index 0c971f1b712b..ce5776c8e465 100644 --- a/nixos/tests/default.nix +++ b/nixos/tests/default.nix @@ -21,6 +21,7 @@ with import ../lib/testing.nix { inherit system minimal; }; #mpich = makeTest (import ./mpich.nix); mysql = makeTest (import ./mysql.nix); mysql_replication = makeTest (import ./mysql-replication.nix); + munin = makeTest (import ./munin.nix); nat = makeTest (import ./nat.nix); nfs3 = makeTest (import ./nfs.nix { version = 3; }); #nfs4 = makeTest (import ./nfs.nix { version = 4; }); diff --git a/nixos/tests/munin.nix b/nixos/tests/munin.nix new file mode 100644 index 000000000000..66ae1c0d87f7 --- /dev/null +++ b/nixos/tests/munin.nix @@ -0,0 +1,31 @@ +{ pkgs, ... }: + +# This test runs basic munin setup with node and cron job running on the same +# machine. + +{ + nodes = { + one = + { config, pkgs, ... }: + { + services = { + munin-node.enable = true; + munin-cron = { + enable = true; + hosts = '' + [${config.networking.hostName}] + address localhost + ''; + }; + }; + }; + }; + + testScript = '' + startAll; + + $one->waitForUnit("munin-node.service"); + $one->waitForFile("/var/lib/munin/one/one-uptime-uptime-g.rrd"); + $one->waitForFile("/var/www/munin/one/index.html"); + ''; +}