about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2023-05-12 14:45:17 -0700
committerFranck Cuny <franck@fcuny.net>2023-05-12 14:45:17 -0700
commit83d862a60414b18e03b24c1e5ac198bf4c5bf662 (patch)
tree9649ab7331bada6fdc7887b2baa45b0fa203f341
parenthosts/carmel: fix proxy_pass configuration (diff)
downloadworld-83d862a60414b18e03b24c1e5ac198bf4c5bf662.tar.gz
profiles/monitoring: move node exporter to a profile
-rw-r--r--hosts/carmel/default.nix1
-rw-r--r--hosts/carmel/services.nix1
-rw-r--r--hosts/tahoe/default.nix1
-rw-r--r--hosts/tahoe/services.nix1
-rw-r--r--modules/services/monitoring/default.nix1
-rw-r--r--modules/services/monitoring/node-exporter.nix19
-rw-r--r--profiles/monitoring/exporter.nix7
7 files changed, 9 insertions, 22 deletions
diff --git a/hosts/carmel/default.nix b/hosts/carmel/default.nix
index 4f86d90..b50c036 100644
--- a/hosts/carmel/default.nix
+++ b/hosts/carmel/default.nix
@@ -9,6 +9,7 @@
     "${self}/profiles/hardware/amd.nix"
     "${self}/profiles/nginx.nix"
     "${self}/profiles/router.nix"
+    "${self}/profiles/monitoring/exporter.nix"
   ];
 
   boot.loader.efi.efiSysMountPoint = "/boot/efi";
diff --git a/hosts/carmel/services.nix b/hosts/carmel/services.nix
index f176d78..5b6055e 100644
--- a/hosts/carmel/services.nix
+++ b/hosts/carmel/services.nix
@@ -1,7 +1,6 @@
 { config, pkgs, ... }: {
   my.services = {
     monitoring = {
-      node-exporter.enable = true;
       promtail.enable = true;
     };
   };
diff --git a/hosts/tahoe/default.nix b/hosts/tahoe/default.nix
index 2c4d8ec..a5a6533 100644
--- a/hosts/tahoe/default.nix
+++ b/hosts/tahoe/default.nix
@@ -17,6 +17,7 @@ in
     "${self}/profiles/git-server.nix"
     "${self}/profiles/music-server.nix"
     "${self}/profiles/hardware/amd.nix"
+    "${self}/profiles/monitoring/exporter.nix"
   ];
 
   # Use systemd-networkd for networking
diff --git a/hosts/tahoe/services.nix b/hosts/tahoe/services.nix
index 4056df3..b8745e4 100644
--- a/hosts/tahoe/services.nix
+++ b/hosts/tahoe/services.nix
@@ -21,7 +21,6 @@ in
         vhostName = "dash.${config.homelab.domain}";
       };
       promtail.enable = true;
-      node-exporter.enable = true;
     };
 
     sendsms.enable = true;
diff --git a/modules/services/monitoring/default.nix b/modules/services/monitoring/default.nix
index d8c9790..fe1e219 100644
--- a/modules/services/monitoring/default.nix
+++ b/modules/services/monitoring/default.nix
@@ -6,7 +6,6 @@ in
   imports = [
     ./grafana.nix
     ./loki.nix
-    ./node-exporter.nix
     ./prometheus.nix
     ./promtail.nix
   ];
diff --git a/modules/services/monitoring/node-exporter.nix b/modules/services/monitoring/node-exporter.nix
deleted file mode 100644
index a205bba..0000000
--- a/modules/services/monitoring/node-exporter.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-{ config, pkgs, lib, ... }:
-let cfg = config.my.services.monitoring.node-exporter;
-in
-{
-  options.my.services.monitoring.node-exporter = with lib; {
-    enable = mkEnableOption "Prometheus metrics exporter";
-  };
-
-  config = lib.mkIf cfg.enable {
-    services.prometheus = {
-      exporters = {
-        node = {
-          enable = true;
-          enabledCollectors = [ "tcpstat" "systemd" "interrupts" ];
-        };
-      };
-    };
-  };
-}
diff --git a/profiles/monitoring/exporter.nix b/profiles/monitoring/exporter.nix
new file mode 100644
index 0000000..ded6423
--- /dev/null
+++ b/profiles/monitoring/exporter.nix
@@ -0,0 +1,7 @@
+{ ... }:
+{
+  services.prometheus.exporters.node = {
+    enable = true;
+    enabledCollectors = [ "tcpstat" "systemd" "interrupts" ];
+  };
+}