From a4d83d6bb8c7337ad5d39019e026d4e996494404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Mon, 18 Mar 2024 00:18:17 +0100 Subject: [PATCH] Add monitoring services --- hosts/gunter/configuration.nix | 1 + system/monitoring.nix | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 system/monitoring.nix diff --git a/hosts/gunter/configuration.nix b/hosts/gunter/configuration.nix index e6c4875..413b189 100644 --- a/hosts/gunter/configuration.nix +++ b/hosts/gunter/configuration.nix @@ -3,6 +3,7 @@ { imports = [ ./hardware-configuration.nix + ../../system/monitoring.nix ]; # Sops stuff diff --git a/system/monitoring.nix b/system/monitoring.nix new file mode 100644 index 0000000..56adbfd --- /dev/null +++ b/system/monitoring.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + prometheus-node-exporter + prometheus-systemd-exporter + ]; + + systemd.services."node-exporter" = { + enable = true; + unitConfig = { + Description = "Prometheus Node Exporter"; + After = [ "network.target" ]; + }; + serviceConfig = { + ExecStart = "${pkgs.prometheus-node-exporter}/bin/node_exporter"; + }; + wantedBy = [ "multi-user.target" ]; + }; + + systemd.services."systemd-exporter" = { + enable = true; + unitConfig = { + Description = "Prometheus Systemd Exporter"; + After = [ "network.target" ]; + }; + serviceConfig = { + ExecStart = "${pkgs.prometheus-systemd-exporter}/bin/systemd_exporter"; + }; + wantedBy = [ "multi-user.target" ]; + }; + + networking.firewall.allowedTCPPorts = [ 9100 9558 ]; +}