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