about summary refs log tree commit diff
path: root/modules/grafana.nix
diff options
context:
space:
mode:
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