Skip to content

Commit

Permalink
munin: fix tests by replacing cron with systemd timer
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Mar 21, 2017
1 parent 2e06a58 commit b4169bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
20 changes: 16 additions & 4 deletions nixos/modules/services/monitoring/munin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,26 @@ in

}) (mkIf cronCfg.enable {

services.cron.systemCronJobs = [
"*/5 * * * * munin ${pkgs.munin}/bin/munin-cron --config ${muninConf}"
];
systemd.timers.munin-cron = {
description = "batch Munin master programs";
wantedBy = [ "timers.target" ];
timerConfig.OnCalendar = "*:0/5";
};

systemd.services.munin-cron = {
description = "batch Munin master programs";
unitConfig.Documentation = "man:munin-cron(8)";

serviceConfig = {
Type = "oneshot";
User = "munin";
ExecStart = "${pkgs.munin}/bin/munin-cron --config ${muninConf}";
};
};

system.activationScripts.munin-cron = stringAfter [ "users" "groups" ] ''
mkdir -p /var/{run,log,www,lib}/munin
chown -R munin:munin /var/{run,log,www,lib}/munin
'';

})];
}
1 change: 1 addition & 0 deletions nixos/tests/munin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import ./make-test.nix ({ pkgs, ...} : {
startAll;
$one->waitForUnit("munin-node.service");
$one->succeed('systemctl start munin-cron');
$one->waitForFile("/var/lib/munin/one/one-uptime-uptime-g.rrd");
$one->waitForFile("/var/www/munin/one/index.html");
'';
Expand Down

0 comments on commit b4169bb

Please sign in to comment.