1{ pkgs, ... }:
2{
3 name = "smokeping";
4 meta = with pkgs.lib.maintainers; {
5 maintainers = [ cransom ];
6 };
7
8 nodes = {
9 sm =
10 { ... }:
11 {
12 networking.domain = "example.com"; # FQDN: sm.example.com
13 services.smokeping = {
14 enable = true;
15 mailHost = "127.0.0.2";
16 probeConfig = ''
17 + FPing
18 binary = /run/wrappers/bin/fping
19 offset = 0%
20 '';
21 };
22 };
23 };
24
25 testScript = ''
26 start_all()
27 sm.wait_for_unit("smokeping")
28 sm.wait_for_unit("nginx")
29 sm.wait_for_file("/var/lib/smokeping/data/Local/LocalMachine.rrd")
30 sm.succeed("curl -s -f localhost/smokeping.fcgi?target=Local")
31 # Check that there's a helpful page without explicit path as well.
32 sm.succeed("curl -s -f localhost")
33 sm.succeed("ls /var/lib/smokeping/cache/Local/LocalMachine_mini.png")
34 sm.succeed("ls /var/lib/smokeping/cache/index.html")
35
36 # stop and start the service like nixos-rebuild would do
37 # see https://github.com/NixOS/nixpkgs/issues/265953)
38 sm.succeed("systemctl stop smokeping")
39 sm.succeed("systemctl start smokeping")
40 # ensure all services restarted properly
41 sm.succeed("systemctl --failed | grep -q '0 loaded units listed'")
42 '';
43}