1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00
nixpkgs/nixos/tests/prometheus-2.nix

35 lines
773 B
Nix
Raw Normal View History

2019-02-21 15:32:46 +00:00
import ./make-test.nix {
name = "prometheus-2";
nodes = {
one = { pkgs, ... }: {
services.prometheus2 = {
enable = true;
scrapeConfigs = [{
job_name = "prometheus";
static_configs = [{
targets = [ "127.0.0.1:9090" ];
labels = { instance = "localhost"; };
}];
}];
rules = [
''
groups:
- name: test
rules:
- record: testrule
expr: count(up{job="prometheus"})
''
];
};
};
};
testScript = ''
startAll;
$one->waitForUnit("prometheus2.service");
$one->waitForOpenPort(9090);
$one->succeed("curl -s http://127.0.0.1:9090/metrics");
'';
}