From 559c5a47ad80dc56270712acc331e114785d9ba2 Mon Sep 17 00:00:00 2001 From: Gonne Kretschmer Date: Mon, 23 Oct 2023 19:39:38 +0200 Subject: [PATCH 1/5] Enable prometheus node exporter by default --- nixos/roles/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nixos/roles/default.nix b/nixos/roles/default.nix index 1968de3..3752a32 100644 --- a/nixos/roles/default.nix +++ b/nixos/roles/default.nix @@ -55,5 +55,12 @@ services = { PasswordAuthentication = false; }; }; + + prometheus.exporters.node = { + enable = true; + port = 9100; + }; }; +# Prometheus Monitoring +networking.firewall.allowedTCPPorts = [ 9100 ]; } -- 2.39.5 From 1de0d328607e3323ea6f7619c31331c28a3b69b3 Mon Sep 17 00:00:00 2001 From: Gonne Kretschmer Date: Fri, 27 Oct 2023 16:01:07 +0200 Subject: [PATCH 2/5] Prometheus Node Exporter metrics configured. --- nixos/roles/default.nix | 8 +----- nixos/roles/prometheusNodeExporter.nix | 36 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 nixos/roles/prometheusNodeExporter.nix diff --git a/nixos/roles/default.nix b/nixos/roles/default.nix index 3752a32..bc94eff 100644 --- a/nixos/roles/default.nix +++ b/nixos/roles/default.nix @@ -3,6 +3,7 @@ imports = [ ./admins.nix ./nix_keys.nix + ./prometheusNodeExporter.nix (modulesPath + "/virtualisation/xen-domU.nix") ../modules/impermanence.nix ]; @@ -55,12 +56,5 @@ services = { PasswordAuthentication = false; }; }; - - prometheus.exporters.node = { - enable = true; - port = 9100; }; -}; -# Prometheus Monitoring -networking.firewall.allowedTCPPorts = [ 9100 ]; } diff --git a/nixos/roles/prometheusNodeExporter.nix b/nixos/roles/prometheusNodeExporter.nix new file mode 100644 index 0000000..e717411 --- /dev/null +++ b/nixos/roles/prometheusNodeExporter.nix @@ -0,0 +1,36 @@ +{ + imports = [ ]; + services.prometheus.exporters.node = { + enable = true; + port = 9100; + # Aligned with https://git.rwth-aachen.de/fsdmath/server/prometheus/-/blob/main/node_exporter/etc/default/prometheus-node-exporter + # Original reasons are for these lists are unknown, but along the lines + # “This looks useless for VMs, but that seems nice.” + disabledCollectors = [ + "arp" + "bcache" + "btrfs" + "dmi" + "fibrechannel" + "infiniband" + "nfs" + "nvme" + "powersupplyclass" + "rapl" + "selinux" + "tapestats" + "thermal_zone" + "udp_queues" + "xfs" + "zfs" + ]; + enabledCollectors = [ + "buddyinfo" + "ksmd" + "logind" + "mountstats" + "processes" + ]; + }; + networking.firewall.allowedTCPPorts = [ 9100 ]; +} -- 2.39.5 From 2c2b24d0a9c85af0fddd425b28d62d35d04989d9 Mon Sep 17 00:00:00 2001 From: Gonne Kretschmer Date: Fri, 3 Nov 2023 16:39:28 +0100 Subject: [PATCH 3/5] Setup Impermanence --- nixos/roles/default.nix | 2 +- nixos/roles/prometheusNodeExporter.nix | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/roles/default.nix b/nixos/roles/default.nix index bc94eff..b536d28 100644 --- a/nixos/roles/default.nix +++ b/nixos/roles/default.nix @@ -56,5 +56,5 @@ services = { PasswordAuthentication = false; }; }; - }; +}; } diff --git a/nixos/roles/prometheusNodeExporter.nix b/nixos/roles/prometheusNodeExporter.nix index e717411..749c6f4 100644 --- a/nixos/roles/prometheusNodeExporter.nix +++ b/nixos/roles/prometheusNodeExporter.nix @@ -1,3 +1,4 @@ +{config, ...}: { imports = [ ]; services.prometheus.exporters.node = { @@ -33,4 +34,5 @@ ]; }; networking.firewall.allowedTCPPorts = [ 9100 ]; + environment.persistence.${config.impermanence.name}.directories = [ "/var/lib/${config.services.prometheus.stateDir}" ]; } -- 2.39.5 From a41d377f96235155b61791908997be5b798bc2ce Mon Sep 17 00:00:00 2001 From: Gonne Kretschmer Date: Fri, 3 Nov 2023 16:46:26 +0100 Subject: [PATCH 4/5] Reenable nfs collector --- nixos/roles/prometheusNodeExporter.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/nixos/roles/prometheusNodeExporter.nix b/nixos/roles/prometheusNodeExporter.nix index 749c6f4..59cacc1 100644 --- a/nixos/roles/prometheusNodeExporter.nix +++ b/nixos/roles/prometheusNodeExporter.nix @@ -14,7 +14,6 @@ "dmi" "fibrechannel" "infiniband" - "nfs" "nvme" "powersupplyclass" "rapl" -- 2.39.5 From b2f094547390a914527628137e283871b0ff268c Mon Sep 17 00:00:00 2001 From: Gonne Kretschmer Date: Mon, 6 Nov 2023 12:47:55 +0100 Subject: [PATCH 5/5] Improve comment explaining metrics selection --- nixos/roles/prometheusNodeExporter.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nixos/roles/prometheusNodeExporter.nix b/nixos/roles/prometheusNodeExporter.nix index 59cacc1..9587b2f 100644 --- a/nixos/roles/prometheusNodeExporter.nix +++ b/nixos/roles/prometheusNodeExporter.nix @@ -5,8 +5,11 @@ enable = true; port = 9100; # Aligned with https://git.rwth-aachen.de/fsdmath/server/prometheus/-/blob/main/node_exporter/etc/default/prometheus-node-exporter - # Original reasons are for these lists are unknown, but along the lines - # “This looks useless for VMs, but that seems nice.” + # It was compiled along the following steps: + # 1. Does the current Debian release supports the collector? + # 2. Is the collector depracated in the latest release? + # 3. Could you probably use the collected metrics for monitoring or are they useless because they make no sense in our context + # (e.g. power adapter inside a VM, use fibre port connection)? disabledCollectors = [ "arp" "bcache" -- 2.39.5