mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 22:50:49 +00:00
58869cf310
This is based on @benleys work: https://github.com/NixOS/nixpkgs/pull/8216 I updated changed the user and group ids.
30 lines
697 B
Nix
30 lines
697 B
Nix
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");
|
|
'';
|
|
}
|