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 ]; +}