about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--users/flokli/nixos/nixos-tvix-cache/monitoring.nix26
1 files changed, 26 insertions, 0 deletions
diff --git a/users/flokli/nixos/nixos-tvix-cache/monitoring.nix b/users/flokli/nixos/nixos-tvix-cache/monitoring.nix
index 32cb7ddc0e11..77bca42d633f 100644
--- a/users/flokli/nixos/nixos-tvix-cache/monitoring.nix
+++ b/users/flokli/nixos/nixos-tvix-cache/monitoring.nix
@@ -34,6 +34,32 @@ in
     };
   };
 
+  services.alloy.enable = true;
+
+  environment.etc."alloy/config.alloy".text = ''
+    prometheus.exporter.unix "main" { }
+
+    prometheus.scrape "main" {
+      targets    = prometheus.exporter.unix.main.targets
+      forward_to = [otelcol.receiver.prometheus.default.receiver]
+    }
+
+    otelcol.receiver.prometheus "default" {
+      output {
+        metrics = [otelcol.exporter.otlp.default.input]
+      }
+    }
+
+    otelcol.exporter.otlp "default" {
+      client {
+        endpoint = "127.0.0.1:4317"
+        tls {
+          insecure = true
+        }
+      }
+    }
+  '';
+
   services.opentelemetry-collector = {
     enable = true;
     settings = {