about summary refs log tree commit diff
path: root/nixos/modules/services/monitoring
diff options
context:
space:
mode:
authorMatthias Treydte <mt@waldheinz.de>2021-10-13 15:37:02 +0200
committerProfpatsch <mail@profpatsch.de>2021-10-14 11:26:29 +0200
commit72fbd63c5c14e29b36e3161b086a653dd9a87158 (patch)
tree946cb46355ac6de128f54b57cc2a50946f502576 /nixos/modules/services/monitoring
parentae7ce180dd8bd30721d19dd1c2e6af00fce0d9ec (diff)
downloadnixlib-72fbd63c5c14e29b36e3161b086a653dd9a87158.tar
nixlib-72fbd63c5c14e29b36e3161b086a653dd9a87158.tar.gz
nixlib-72fbd63c5c14e29b36e3161b086a653dd9a87158.tar.bz2
nixlib-72fbd63c5c14e29b36e3161b086a653dd9a87158.tar.lz
nixlib-72fbd63c5c14e29b36e3161b086a653dd9a87158.tar.xz
nixlib-72fbd63c5c14e29b36e3161b086a653dd9a87158.tar.zst
nixlib-72fbd63c5c14e29b36e3161b086a653dd9a87158.zip
nixos/prometheus: fix node exporter timex collector
The timex collector (enabled by default) needs the
adjtimex syscall, which was disabled by
9fea6d4c8551b7c8783f23e011a2ba113c95d0dd.

So allow it unless the timex collector is disabled.
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters.nix2
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/node.nix2
2 files changed, 3 insertions, 1 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix
index b40d6b3ca004..62e90232e114 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters.nix
@@ -192,7 +192,7 @@ let
         serviceConfig.MemoryDenyWriteExecute = true;
         serviceConfig.NoNewPrivileges = true;
         serviceConfig.PrivateDevices = true;
-        serviceConfig.ProtectClock = true;
+        serviceConfig.ProtectClock = mkDefault true;
         serviceConfig.ProtectControlGroups = true;
         serviceConfig.ProtectHome = true;
         serviceConfig.ProtectHostname = true;
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/node.nix b/nixos/modules/services/monitoring/prometheus/exporters/node.nix
index bc89799006eb..baac21b050f5 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/node.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/node.nix
@@ -37,6 +37,8 @@ in
       '';
       # The systemd collector needs AF_UNIX
       RestrictAddressFamilies = lib.optional (lib.any (x: x == "systemd") cfg.enabledCollectors) "AF_UNIX";
+      # The timex collector needs to access clock APIs
+      ProtectClock = lib.any (x: x == "timex") cfg.disabledCollectors;
     };
   };
 }