From 3f517bbe7fa5a9b802addbc1ae323a867b9f43a4 Mon Sep 17 00:00:00 2001 From: Katharina Heidenreich Date: Sat, 11 Apr 2026 13:09:38 +0200 Subject: [PATCH] feat: add node exporter --- config/services.nix | 8 ++++++++ services/default.nix | 1 + services/node-exporter.nix | 12 ++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 services/node-exporter.nix diff --git a/config/services.nix b/config/services.nix index 2d42a3b..d62ce92 100644 --- a/config/services.nix +++ b/config/services.nix @@ -3,4 +3,12 @@ rec { port = 3000; domain = "git.nudelerde.de"; }; + + "metric-exporter" = { + port = 9100; + collectors = [ + "systemd" + "processes" + ]; + }; } diff --git a/services/default.nix b/services/default.nix index 8fc6c4b..1e9cfb5 100644 --- a/services/default.nix +++ b/services/default.nix @@ -3,5 +3,6 @@ imports = [ ./openssh.nix ./forgejo.nix + ./node-exporter.nix ]; } diff --git a/services/node-exporter.nix b/services/node-exporter.nix new file mode 100644 index 0000000..c313e8e --- /dev/null +++ b/services/node-exporter.nix @@ -0,0 +1,12 @@ +{ config, pkgs, lib, ... }: +let + serv = import ../config/services.nix; +in { + services.prometheus.exporters.node = { + enable = true; + port = serv."metric-exporter".port; + enabledCollectors = serv."metric-exporter".collectors; + }; + + networking.firewall.allowedTCPPorts = [ serv."metric-exporter".port ]; +}