1 import ../make-test-python.nix (
5 name = "prometheus-remote-write";
11 environment.systemPackages = [ pkgs.jq ];
13 networking.firewall.allowedTCPPorts = [ config.services.prometheus.port ];
15 services.prometheus = {
17 globalConfig.scrape_interval = "2s";
19 extraFlags = [ "--web.enable-remote-write-receiver" ];
24 { config, pkgs, ... }:
26 environment.systemPackages = [ pkgs.jq ];
28 networking.firewall.allowedTCPPorts = [ config.services.prometheus.port ];
30 services.prometheus = {
32 globalConfig.scrape_interval = "2s";
36 url = "http://receiver:9090/api/v1/write";
46 "node:${toString config.services.prometheus.exporters.node.port}"
56 { config, pkgs, ... }:
58 services.prometheus.exporters.node = {
66 node.wait_for_unit("prometheus-node-exporter")
67 node.wait_for_open_port(9100)
69 for machine in prometheus, receiver:
70 machine.wait_for_unit("prometheus")
71 machine.wait_for_open_port(9090)
73 # Verify both servers got the same data from the exporter
74 for machine in prometheus, receiver:
75 machine.wait_until_succeeds(
76 "curl -sf 'http://127.0.0.1:9090/api/v1/query?query=node_exporter_build_info\{instance=\"node:9100\"\}' | "
77 + "jq '.data.result[0].value[1]' | grep '\"1\"'"