From 231d777fa7cb8b6a6daadbb0c6a84649771397bf Mon Sep 17 00:00:00 2001 From: Alejandro Angulo Date: Sun, 10 Sep 2023 14:37:51 -0700 Subject: [PATCH] Manages datasources --- modules/services/grafana/default.nix | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/services/grafana/default.nix b/modules/services/grafana/default.nix index 488d0fa..3f5ffd8 100644 --- a/modules/services/grafana/default.nix +++ b/modules/services/grafana/default.nix @@ -28,6 +28,28 @@ in { http_port = 2342; http_addr = "0.0.0.0"; }; + + provision = { + enable = true; + datasources = { + # This assumes prometheus, loki, and grafana are all running on the + # same host. + settings.datasources = [ + { + name = "Prometheus"; + type = "prometheus"; + access = "proxy"; + url = "http://127.0.0.1:${toString config.services.prometheus.port}"; + } + { + name = "Loki"; + type = "loki"; + access = "proxy"; + url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}"; + } + ]; + }; + }; }; services.nginx = {