summary refs log tree commit diff
path: root/nixos/modules/services/monitoring/prometheus/exporters/node.nix
diff options
context:
space:
mode:
authorMatthias Treydte <mt@waldheinz.de>2021-10-13 12:57:34 +0200
committerProfpatsch <mail@profpatsch.de>2021-10-14 11:26:29 +0200
commitae7ce180dd8bd30721d19dd1c2e6af00fce0d9ec (patch)
tree58c128965e31850a01063c89369e0201881c511e /nixos/modules/services/monitoring/prometheus/exporters/node.nix
parentb8ffa68b3582f412c580765392f2ec5a8d2eb1f5 (diff)
downloadnixpkgs-ae7ce180dd8bd30721d19dd1c2e6af00fce0d9ec.tar
nixpkgs-ae7ce180dd8bd30721d19dd1c2e6af00fce0d9ec.tar.gz
nixpkgs-ae7ce180dd8bd30721d19dd1c2e6af00fce0d9ec.tar.bz2
nixpkgs-ae7ce180dd8bd30721d19dd1c2e6af00fce0d9ec.tar.lz
nixpkgs-ae7ce180dd8bd30721d19dd1c2e6af00fce0d9ec.tar.xz
nixpkgs-ae7ce180dd8bd30721d19dd1c2e6af00fce0d9ec.tar.zst
nixpkgs-ae7ce180dd8bd30721d19dd1c2e6af00fce0d9ec.zip
nixos/prometheus: fix node exporter systemd collector
The systemd collector needs AF_UNIX to talk to
/var/run/dbus/system_bus_socket, which was broken
with 9fea6d4c8551b7c8783f23e011a2ba113c95d0dd.

This commit allows AF_UNIX when needed.
Diffstat (limited to 'nixos/modules/services/monitoring/prometheus/exporters/node.nix')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/node.nix2
1 files changed, 2 insertions, 0 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/node.nix b/nixos/modules/services/monitoring/prometheus/exporters/node.nix
index ed594460d95..bc89799006e 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/node.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/node.nix
@@ -35,6 +35,8 @@ in
           ${concatMapStringsSep " " (x: "--no-collector." + x) cfg.disabledCollectors} \
           --web.listen-address ${cfg.listenAddress}:${toString cfg.port} ${concatStringsSep " " cfg.extraFlags}
       '';
+      # The systemd collector needs AF_UNIX
+      RestrictAddressFamilies = lib.optional (lib.any (x: x == "systemd") cfg.enabledCollectors) "AF_UNIX";
     };
   };
 }