2019-11-08 17:13:17 +01:00
|
|
|
import ./make-test-python.nix (
|
|
|
|
{ pkgs, ... }:
|
|
|
|
{
|
2016-07-20 19:07:59 -04:00
|
|
|
name = "smokeping";
|
2021-01-10 20:08:30 +01:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2016-07-20 19:07:59 -04:00
|
|
|
maintainers = [ cransom ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
sm =
|
2018-07-20 20:56:59 +00:00
|
|
|
{ ... }:
|
2016-07-20 19:07:59 -04:00
|
|
|
{
|
2021-01-17 20:42:20 +01:00
|
|
|
networking.domain = "example.com"; # FQDN: sm.example.com
|
2016-07-20 19:07:59 -04:00
|
|
|
services.smokeping = {
|
|
|
|
enable = true;
|
2016-10-08 15:04:27 +00:00
|
|
|
mailHost = "127.0.0.2";
|
2016-07-20 19:07:59 -04:00
|
|
|
probeConfig = ''
|
|
|
|
+ FPing
|
2017-01-29 04:11:01 -06:00
|
|
|
binary = /run/wrappers/bin/fping
|
2016-07-20 19:07:59 -04:00
|
|
|
offset = 0%
|
|
|
|
'';
|
2024-12-10 20:26:33 +01:00
|
|
|
};
|
2016-07-20 19:07:59 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2019-11-08 17:13:17 +01:00
|
|
|
start_all()
|
|
|
|
sm.wait_for_unit("smokeping")
|
2024-05-12 12:55:43 +02:00
|
|
|
sm.wait_for_unit("nginx")
|
2019-11-08 17:13:17 +01:00
|
|
|
sm.wait_for_file("/var/lib/smokeping/data/Local/LocalMachine.rrd")
|
2024-05-12 12:55:43 +02:00
|
|
|
sm.succeed("curl -s -f localhost/smokeping.fcgi?target=Local")
|
2022-10-25 15:53:43 +02:00
|
|
|
# Check that there's a helpful page without explicit path as well.
|
2024-05-12 12:55:43 +02:00
|
|
|
sm.succeed("curl -s -f localhost")
|
2019-11-08 17:13:17 +01:00
|
|
|
sm.succeed("ls /var/lib/smokeping/cache/Local/LocalMachine_mini.png")
|
|
|
|
sm.succeed("ls /var/lib/smokeping/cache/index.html")
|
2024-05-12 12:55:43 +02:00
|
|
|
|
|
|
|
# stop and start the service like nixos-rebuild would do
|
|
|
|
# see https://github.com/NixOS/nixpkgs/issues/265953)
|
|
|
|
sm.succeed("systemctl stop smokeping")
|
|
|
|
sm.succeed("systemctl start smokeping")
|
|
|
|
# ensure all services restarted properly
|
|
|
|
sm.succeed("systemctl --failed | grep -q '0 loaded units listed'")
|
2016-07-20 19:07:59 -04:00
|
|
|
'';
|
|
|
|
}
|
|
|
|
)
|