Merge pull request #198638 from KFearsoff/fix-node-exporter-netdev-collector
nixos/prometheus-node-exporter: fix netdev collect
This commit is contained in:
commit
7519cb2c7c
@ -4,6 +4,8 @@ with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.prometheus.exporters.node;
|
||||
collectorIsEnabled = final: any (collector: (final == collector)) cfg.enabledCollectors;
|
||||
collectorIsDisabled = final: any (collector: (final == collector)) cfg.disabledCollectors;
|
||||
in
|
||||
{
|
||||
port = 9100;
|
||||
@ -35,15 +37,15 @@ in
|
||||
${concatMapStringsSep " " (x: "--no-collector." + x) cfg.disabledCollectors} \
|
||||
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} ${concatStringsSep " " cfg.extraFlags}
|
||||
'';
|
||||
RestrictAddressFamilies = optionals (any (collector: (collector == "logind" || collector == "systemd")) cfg.enabledCollectors) [
|
||||
RestrictAddressFamilies = optionals (collectorIsEnabled "logind" || collectorIsEnabled "systemd") [
|
||||
# needs access to dbus via unix sockets (logind/systemd)
|
||||
"AF_UNIX"
|
||||
] ++ optionals (any (collector: (collector == "network_route" || collector == "wifi")) cfg.enabledCollectors) [
|
||||
] ++ optionals (collectorIsEnabled "network_route" || collectorIsEnabled "wifi" || ! collectorIsDisabled "netdev") [
|
||||
# needs netlink sockets for wireless collector
|
||||
"AF_NETLINK"
|
||||
];
|
||||
# The timex collector needs to access clock APIs
|
||||
ProtectClock = any (collector: collector == "timex") cfg.disabledCollectors;
|
||||
ProtectClock = collectorIsDisabled "timex";
|
||||
# Allow space monitoring under /home
|
||||
ProtectHome = true;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user