summaryrefslogtreecommitdiffstats
path: root/nixos/tests/gatus.nix
blob: 8f679226f067275f49c63f4d7e215bf12ceca4af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ pkgs, ... }:
{
  name = "gatus";
  meta.maintainers = with pkgs.lib.maintainers; [ pizzapim ];

  nodes.machine =
    { ... }:
    {
      services.gatus = {
        enable = true;

        settings = {
          web.port = 8080;
          metrics = true;

          endpoints = [
            {
              name = "metrics";
              url = "http://localhost:8080/metrics";
              interval = "1s";
              conditions = [
                "[STATUS] == 200"
              ];
            }
          ];
        };
      };
    };

  testScript = ''
    machine.wait_for_unit("gatus.service")
    machine.wait_until_succeeds("curl -s http://localhost:8080/metrics | grep go_info", timeout=60)
  '';
}