Commit 1bb2a84
Changed files (5)
modules
hosts
cyrene
services
hyacine
services
mobius
services
tribios
services
services
modules/hosts/cyrene/services/default.nix
@@ -70,6 +70,7 @@
services.forgejo.server
services.headplane
services.headscale
+ services.node-exporter
services.ntfy-sh
services.tailscale-relay
services.vaultwarden
modules/hosts/hyacine/services/default.nix
@@ -21,6 +21,7 @@
services.caddy.reality
services.xray
+ services.node-exporter
services.yarr
];
}
modules/hosts/mobius/services/default.nix
@@ -50,6 +50,7 @@
services.forgejo.runner
services.navidrome
+ services.node-exporter
services.woodpecker.agent
];
}
modules/hosts/tribios/services/default.nix
@@ -0,0 +1,10 @@
+{den, ...}: {
+ den.hosts.tribios = {
+ settings = {
+ };
+ };
+
+ den.aspects.tribios.includes = with den.aspects; [
+ services.node-exporter
+ ];
+}
modules/services/node-exporter.nix
@@ -0,0 +1,46 @@
+{lib, ...}: {
+ den.aspects.services.node-exporter = {
+ settings.host = {host, ...}: {
+ address = lib.mkOption {
+ type = lib.types.str;
+ default = let
+ tsIp = host.address.ipv4.tailscale;
+ in
+ if tsIp != null
+ then tsIp
+ else "127.0.0.1";
+ };
+ port = lib.mkOption {
+ type = lib.types.port;
+ default = 9100;
+ };
+ enabledCollectors = lib.mkOption {
+ type = lib.types.listOf lib.types.str;
+ default = [
+ ];
+ };
+ disabledCollectors = lib.mkOption {
+ type = lib.types.listOf lib.types.str;
+ default = [
+ ];
+ };
+ };
+
+ tailscaleGrant = {host, ...}: [
+ {
+ src = ["autogroup:member"];
+ ip = ["tcp:${toString host.settings.services.node-exporter.port}"];
+ }
+ ];
+
+ nixos = {host, ...}: let
+ cfg = host.settings.services.node-exporter;
+ in {
+ services.prometheus.exporters.node = {
+ enable = true;
+ listenAddress = cfg.address;
+ inherit (cfg) port enabledCollectors disabledCollectors;
+ };
+ };
+ };
+}