1 import ./make-test-python.nix (
6 meta = with lib.maintainers; {
7 maintainers = [ nukaduka ];
13 environment.systemPackages = with pkgs; [ prometheus-alertmanager ];
14 services.prometheus = {
18 scrape_interval = "5s";
19 scrape_timeout = "5s";
20 evaluation_interval = "5s";
25 job_name = "prometheus";
26 scrape_interval = "5s";
29 targets = [ "localhost:9090" ];
44 severity: bottom of the barrel
65 configuration.route = {
68 group_interval = "5s";
71 configuration.receivers = [
76 url = "http://localhost:1234";
87 extendIfExpiringIn = "30s";
95 with subtest("start the server"):
97 server.wait_for_unit("prometheus.service")
98 server.wait_for_unit("alertmanager.service")
99 server.wait_for_unit("kthxbye.service")
101 server.sleep(2) # wait for units to settle
102 server.systemctl("restart kthxbye.service") # make sure kthxbye comes up after alertmanager
105 with subtest("set up test silence which expires in 20s"):
106 server.succeed('amtool --alertmanager.url "http://localhost:9093" silence add alertname="node_up" -a "nixosTest" -d "20s" -c "ACK! this server is fine!!"')
108 with subtest("wait for 21 seconds and check if the silence is still active"):
110 server.systemctl("status kthxbye.service")
111 server.succeed("amtool --alertmanager.url 'http://localhost:9093' silence | grep 'ACK'")