diff options
author | Benjamin Staffin <ben@folsomlabs.com> | 2015-06-07 23:36:56 -0700 |
---|---|---|
committer | Tom Hunger <tehunger@gmail.com> | 2016-09-04 20:03:32 +0100 |
commit | 58869cf31020c8eca25f63f8c9d6d2d89f731166 (patch) | |
tree | ec08e07e29a4036fadd1393e28d1839fea73c95c /nixos/tests/prometheus.nix | |
parent | 29796bd9892942143528d26b738a659c035393e9 (diff) |
prometheus service: add
This is based on @benleys work: https://github.com/NixOS/nixpkgs/pull/8216 I updated changed the user and group ids.
Diffstat (limited to 'nixos/tests/prometheus.nix')
-rw-r--r-- | nixos/tests/prometheus.nix | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/nixos/tests/prometheus.nix b/nixos/tests/prometheus.nix new file mode 100644 index 0000000000000..7605227100d20 --- /dev/null +++ b/nixos/tests/prometheus.nix @@ -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"); + ''; +} |