prometheus service: add

This is based on @benleys work: https://github.com/NixOS/nixpkgs/pull/8216
I updated changed the user and group ids.
This commit is contained in:
Benjamin Staffin
2016-09-04 20:03:32 +01:00
committed by Tom Hunger
parent 29796bd989
commit 58869cf310
4 changed files with 450 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
import ./make-test.nix {
name = "prometheus";
nodes = {
one = { config, pkgs, ... }: {
services.prometheus = {
enable = true;
globalConfig = {
labels = { foo = "bar"; };
};
scrapeConfigs = [{
job_name = "prometheus";
target_groups = [{
targets = [ "127.0.0.1:9090" ];
labels = { instance = "localhost"; };
}];
}];
rules = [ ''testrule = count(up{job="prometheus"})'' ];
};
};
};
testScript = ''
startAll;
$one->waitForUnit("prometheus.service");
$one->waitForOpenPort(9090);
$one->succeed("curl -s http://127.0.0.1:9090/metrics");
'';
}