10 cfg = config.services.prometheus.exporters.node;
19 collectorIsEnabled = final: any (collector: (final == collector)) cfg.enabledCollectors;
20 collectorIsDisabled = final: any (collector: (final == collector)) cfg.disabledCollectors;
25 enabledCollectors = mkOption {
26 type = types.listOf types.str;
28 example = [ "systemd" ];
30 Collectors to enable. The collectors listed here are enabled in addition to the default ones.
33 disabledCollectors = mkOption {
34 type = types.listOf types.str;
36 example = [ "timex" ];
38 Collectors to disable which are enabled by default.
45 RuntimeDirectory = "prometheus-node-exporter";
47 ${pkgs.prometheus-node-exporter}/bin/node_exporter \
48 ${concatMapStringsSep " " (x: "--collector." + x) cfg.enabledCollectors} \
49 ${concatMapStringsSep " " (x: "--no-collector." + x) cfg.disabledCollectors} \
50 --web.listen-address ${cfg.listenAddress}:${toString cfg.port} ${concatStringsSep " " cfg.extraFlags}
52 RestrictAddressFamilies =
53 optionals (collectorIsEnabled "logind" || collectorIsEnabled "systemd") [
54 # needs access to dbus via unix sockets (logind/systemd)
58 (collectorIsEnabled "network_route" || collectorIsEnabled "wifi" || !collectorIsDisabled "netdev")
60 # needs netlink sockets for wireless collector
63 # The timex collector needs to access clock APIs
64 ProtectClock = collectorIsDisabled "timex";
65 # Allow space monitoring under /home