diff --git a/nixos/modules/services/monitoring/grafana-agent.nix b/nixos/modules/services/monitoring/grafana-agent.nix index 021ddaa8ee0d..bbeda1846470 100644 --- a/nixos/modules/services/monitoring/grafana-agent.nix +++ b/nixos/modules/services/monitoring/grafana-agent.nix @@ -7,7 +7,7 @@ let in { meta = { - maintainers = with maintainers; [ zimbatm ]; + maintainers = with maintainers; [ flokli zimbatm ]; }; options.services.grafana-agent = { @@ -49,14 +49,7 @@ in }; default = { - server = { - # Don't bind on 0.0.0.0 - grpc_listen_address = "127.0.0.1"; - http_listen_address = "127.0.0.1"; - # Don't bind on the default port 80 - http_listen_port = 9090; - }; - prometheus = { + metrics = { wal_directory = "\${STATE_DIRECTORY}"; global.scrape_interval = "5s"; }; @@ -69,7 +62,12 @@ in }; example = { - loki.configs = [{ + metrics.global.remote_write = [{ + url = "\${METRICS_REMOTE_WRITE_URL}"; + basic_auth.username = "\${METRICS_REMOTE_WRITE_USERNAME}"; + basic_auth.password_file = "\${CREDENTIALS_DIRECTORY}/metrics_remote_write_password"; + }]; + logs.configs = [{ name = "default"; scrape_configs = [ { @@ -101,13 +99,6 @@ in basic_auth.password_file = "\${CREDENTIALS_DIRECTORY}/logs_remote_write_password"; }]; }]; - integrations = { - prometheus_remote_write = [{ - url = "\${METRICS_REMOTE_WRITE_URL}"; - basic_auth.username = "\${METRICS_REMOTE_WRITE_USERNAME}"; - basic_auth.password_file = "\${CREDENTIALS_DIRECTORY}/metrics_remote_write_password"; - }]; - }; }; }; }; diff --git a/nixos/tests/grafana-agent.nix b/nixos/tests/grafana-agent.nix index 97f752b350b0..a9f34d8cea31 100644 --- a/nixos/tests/grafana-agent.nix +++ b/nixos/tests/grafana-agent.nix @@ -23,9 +23,9 @@ import ./make-test-python.nix ({ lib, pkgs, ... }: with subtest("Grafana-agent is running"): machine.wait_for_unit("grafana-agent.service") - machine.wait_for_open_port(9090) + machine.wait_for_open_port(12345) machine.succeed( - "curl -sSfN http://127.0.0.1:9090/-/healthy" + "curl -sSfN http://127.0.0.1:12345/-/healthy" ) machine.shutdown() '';