about summary refs log tree commit diff
path: root/nix/hosts/corrino/www/prometheus.emile.space.nix
diff options
context:
space:
mode:
authorEmile <git@emile.space>2024-09-19 22:08:09 +0200
committerEmile <git@emile.space>2024-09-19 22:08:09 +0200
commiteda94c0415da6462750e0ee3a19858f03d8bd8fe (patch)
tree29017a7343b3b00c55240ee3b288a9c032917405 /nix/hosts/corrino/www/prometheus.emile.space.nix
parent7d8bcd0327836408f377484baf29a08c7d053173 (diff)
grafana prometheus loki promtail foo
Diffstat (limited to 'nix/hosts/corrino/www/prometheus.emile.space.nix')
-rw-r--r--nix/hosts/corrino/www/prometheus.emile.space.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/nix/hosts/corrino/www/prometheus.emile.space.nix b/nix/hosts/corrino/www/prometheus.emile.space.nix
new file mode 100644
index 0000000..3fcbd32
--- /dev/null
+++ b/nix/hosts/corrino/www/prometheus.emile.space.nix
@@ -0,0 +1,63 @@
+{ config, ... }:
+
+{
+  services = {
+    nginx.virtualHosts = {
+      "prometheus.emile.space" = {
+        addSSL = true;
+        enableACME = true;
+        locations."/" = {
+          proxyPass = "http://${config.services.prometheus.listenAddress}:${toString config.services.prometheus.port}/";
+          proxyWebsockets = true;
+        };
+      };
+    };
+
+    prometheus = {
+      enable = true;
+      retentionTime = "356d";
+
+      listenAddress = "[::1]";
+      port = config.emile.ports.prometheus.web;
+
+      exporters = {
+        node = {
+          enable = true;
+          enabledCollectors = [ "systemd" ];
+          port = config.emile.ports.prometheus.exporter.node;
+        };
+        systemd = {
+          enable = true;
+          port = config.emile.ports.prometheus.exporter.systemd;
+        };
+        smartctl = {
+          enable = true;
+          port = config.emile.ports.prometheus.exporter.smartctl;
+        };
+        nginx = {
+          enable = true;
+          port = config.emile.ports.prometheus.exporter.nginx;
+        };
+      };
+      scrapeConfigs = [
+        {
+          job_name = "corrino";
+          static_configs = [
+            { targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ]; }
+            { targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.systemd.port}" ]; }
+            { targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}" ]; }
+            { targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.nginx.port}" ]; }
+          ];
+        }
+        {
+          job_name = "lampadas";
+          static_configs = [
+            { targets = [ "lampadas:9100" ]; }
+            { targets = [ "lampadas:9558" ]; }
+            { targets = [ "lampadas:9633" ]; }
+          ];
+        }
+      ];
+    };
+  };
+}