1import ./make-test.nix {
2 name = "prometheus";
3
4 nodes = {
5 one = { ... }: {
6 services.prometheus = {
7 enable = true;
8 scrapeConfigs = [{
9 job_name = "prometheus";
10 static_configs = [{
11 targets = [ "127.0.0.1:9090" ];
12 labels = { instance = "localhost"; };
13 }];
14 }];
15 rules = [ ''testrule = count(up{job="prometheus"})'' ];
16 };
17 };
18 };
19
20 testScript = ''
21 startAll;
22 $one->waitForUnit("prometheus.service");
23 $one->waitForOpenPort(9090);
24 $one->succeed("curl -s http://127.0.0.1:9090/metrics");
25 '';
26}