tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
munin: fix tests by replacing cron with systemd timer
Jörg Thalheim
9 years ago
b4169bb8
2e06a585
+17
-4
2 changed files
expand all
collapse all
unified
split
nixos
modules
services
monitoring
munin.nix
tests
munin.nix
+16
-4
nixos/modules/services/monitoring/munin.nix
···
193
194
}) (mkIf cronCfg.enable {
195
196
-
services.cron.systemCronJobs = [
197
-
"*/5 * * * * munin ${pkgs.munin}/bin/munin-cron --config ${muninConf}"
198
-
];
0
0
0
0
0
0
0
0
0
0
0
0
0
199
200
system.activationScripts.munin-cron = stringAfter [ "users" "groups" ] ''
201
mkdir -p /var/{run,log,www,lib}/munin
202
chown -R munin:munin /var/{run,log,www,lib}/munin
203
'';
204
-
205
})];
206
}
···
193
194
}) (mkIf cronCfg.enable {
195
196
+
systemd.timers.munin-cron = {
197
+
description = "batch Munin master programs";
198
+
wantedBy = [ "timers.target" ];
199
+
timerConfig.OnCalendar = "*:0/5";
200
+
};
201
+
202
+
systemd.services.munin-cron = {
203
+
description = "batch Munin master programs";
204
+
unitConfig.Documentation = "man:munin-cron(8)";
205
+
206
+
serviceConfig = {
207
+
Type = "oneshot";
208
+
User = "munin";
209
+
ExecStart = "${pkgs.munin}/bin/munin-cron --config ${muninConf}";
210
+
};
211
+
};
212
213
system.activationScripts.munin-cron = stringAfter [ "users" "groups" ] ''
214
mkdir -p /var/{run,log,www,lib}/munin
215
chown -R munin:munin /var/{run,log,www,lib}/munin
216
'';
0
217
})];
218
}
+1
nixos/tests/munin.nix
···
29
startAll;
30
31
$one->waitForUnit("munin-node.service");
0
32
$one->waitForFile("/var/lib/munin/one/one-uptime-uptime-g.rrd");
33
$one->waitForFile("/var/www/munin/one/index.html");
34
'';
···
29
startAll;
30
31
$one->waitForUnit("munin-node.service");
32
+
$one->succeed('systemctl start munin-cron');
33
$one->waitForFile("/var/lib/munin/one/one-uptime-uptime-g.rrd");
34
$one->waitForFile("/var/www/munin/one/index.html");
35
'';