summary refs log tree commit diff
path: root/nixos/modules/services/monitoring
diff options
context:
space:
mode:
authorPascal Bach <pascal.bach@nextrem.ch>2017-10-20 22:16:06 +0200
committerRobin Gloster <mail@glob.in>2017-10-22 14:45:48 +0200
commit0f0f0cbc6fb11f8537c3fe293a8451174106274c (patch)
treef4adea76d89b2d9417c3198a238a260fa7e879d9 /nixos/modules/services/monitoring
parent38a66bb033234e4d012a4e12443f7fe44e2f0306 (diff)
downloadnixlib-0f0f0cbc6fb11f8537c3fe293a8451174106274c.tar
nixlib-0f0f0cbc6fb11f8537c3fe293a8451174106274c.tar.gz
nixlib-0f0f0cbc6fb11f8537c3fe293a8451174106274c.tar.bz2
nixlib-0f0f0cbc6fb11f8537c3fe293a8451174106274c.tar.lz
nixlib-0f0f0cbc6fb11f8537c3fe293a8451174106274c.tar.xz
nixlib-0f0f0cbc6fb11f8537c3fe293a8451174106274c.tar.zst
nixlib-0f0f0cbc6fb11f8537c3fe293a8451174106274c.zip
prometheus-node-exporter service: update for new arguments handling
The behaviour have changed again. Listed collectors are now enabled in
addition to the default one.

Also run as DynmicUser instead of user nobody as the exporter doesn't need
any state.
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/prometheus/node-exporter.nix9
1 files changed, 4 insertions, 5 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/node-exporter.nix b/nixos/modules/services/monitoring/prometheus/node-exporter.nix
index b5b852438d77..cacfb67ef06b 100644
--- a/nixos/modules/services/monitoring/prometheus/node-exporter.nix
+++ b/nixos/modules/services/monitoring/prometheus/node-exporter.nix
@@ -33,7 +33,7 @@ in {
         default = [];
         example = ''[ "systemd" ]'';
         description = ''
-          Collectors to enable. Only collectors explicitly listed here will be enabled.
+          Collectors to enable. The collectors listed here are enabled in addition to the default ones.
         '';
       };
 
@@ -64,13 +64,12 @@ in {
       wantedBy = [ "multi-user.target" ];
       script = ''
         exec ${pkgs.prometheus-node-exporter}/bin/node_exporter \
-          ${optionalString (cfg.enabledCollectors != [])
-            ''-collectors.enabled ${concatStringsSep "," cfg.enabledCollectors}''} \
-          -web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
+          ${concatMapStrings (x: "--collector." + x + " ") cfg.enabledCollectors} \
+          --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
           ${concatStringsSep " \\\n  " cfg.extraFlags}
       '';
       serviceConfig = {
-        User = "nobody";
+        DynamicUser = true;
         Restart  = "always";
         PrivateTmp = true;
         WorkingDirectory = /tmp;