about summary refs log tree commit diff
path: root/modules/grafana.nix
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2025-03-12 20:17:13 +0300
committerazahi <azat@bahawi.net>2025-03-12 20:17:13 +0300
commitc81dc5a13b469c511fac6fa2390b70422d1b4da5 (patch)
tree4dab5909006ab5c25da6bd9fde6a714c7719ded7 /modules/grafana.nix
parent2025-02-17 (diff)
2025-03-12 HEAD master
Diffstat (limited to 'modules/grafana.nix')
-rw-r--r--modules/grafana.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/grafana.nix b/modules/grafana.nix
index b1745e5..fd46589 100644
--- a/modules/grafana.nix
+++ b/modules/grafana.nix
@@ -122,6 +122,20 @@ in
         };
       };
 
+      environment.etc."alloy/grafana.alloy".text = ''
+        prometheus.scrape "grafana" {
+          targets = [
+            {
+              __address__ = "127.0.0.1:${toString cfg.port}",
+              instance    = "${config.networking.hostName}",
+            },
+          ]
+          forward_to = [prometheus.relabel.default.receiver]
+        }
+      '';
+
+      systemd.services.alloy.reloadTriggers = [ config.environment.etc."alloy/grafana.alloy".source ];
+
       topology.nodes.${this.hostname}.services.grafana.info = lib.mkForce cfg.domain;
     };
 }

Consider giving Nix/NixOS a try! <3