summary refs log tree commit diff
diff options
context:
space:
mode:
authorajs124 <ajs124@users.noreply.github.com>2022-01-27 18:49:49 +0100
committerGitHub <noreply@github.com>2022-01-27 18:49:49 +0100
commit47a2176ec80b7d74401df84e4c49b86f5b9c30f9 (patch)
tree0c2e3cbc7116bddf1be25d847100d6224d6577ab
parent3a4bed480a4c07385927ab2580ff1c866a1ee8c6 (diff)
parent12c26aca1fd55ab99f831bedc865a626eee39f80 (diff)
downloadnixpkgs-47a2176ec80b7d74401df84e4c49b86f5b9c30f9.tar
nixpkgs-47a2176ec80b7d74401df84e4c49b86f5b9c30f9.tar.gz
nixpkgs-47a2176ec80b7d74401df84e4c49b86f5b9c30f9.tar.bz2
nixpkgs-47a2176ec80b7d74401df84e4c49b86f5b9c30f9.tar.lz
nixpkgs-47a2176ec80b7d74401df84e4c49b86f5b9c30f9.tar.xz
nixpkgs-47a2176ec80b7d74401df84e4c49b86f5b9c30f9.tar.zst
nixpkgs-47a2176ec80b7d74401df84e4c49b86f5b9c30f9.zip
Merge pull request #156998 from mweinelt/smartctl-exporter-fixups
prometheus.exporters.smartctl: fixes
-rw-r--r--nixos/modules/services/monitoring/prometheus/exporters/smartctl.nix15
1 files changed, 13 insertions, 2 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/exporters/smartctl.nix b/nixos/modules/services/monitoring/prometheus/exporters/smartctl.nix
index b6416b93e69..9e49601ce1a 100644
--- a/nixos/modules/services/monitoring/prometheus/exporters/smartctl.nix
+++ b/nixos/modules/services/monitoring/prometheus/exporters/smartctl.nix
@@ -25,7 +25,8 @@ in {
         [ "/dev/sda", "/dev/nvme0n1" ];
       '';
       description = ''
-        Paths to disks that will be monitored.
+        Paths to the disks that will be monitored. Will autodiscover
+        all disks if none given.
       '';
     };
     maxInterval = mkOption {
@@ -41,13 +42,23 @@ in {
   serviceOpts = {
     serviceConfig = {
       AmbientCapabilities = [
+        "CAP_RAW_SYSIO"
         "CAP_SYS_ADMIN"
       ];
       CapabilityBoundingSet = [
+        "CAP_RAW_SYSIO"
         "CAP_SYS_ADMIN"
       ];
       DevicePolicy = "closed";
-      DeviceAllow = lib.mkForce cfg.devices;
+      DeviceAllow = lib.mkOverride 100 (
+        if cfg.devices != [] then
+          cfg.devices
+        else [
+          "block-blkext rw"
+          "block-sd rw"
+          "char-nvme rw"
+        ]
+      );
       ExecStart = ''
         ${pkgs.prometheus-smartctl-exporter}/bin/smartctl_exporter -config ${configFile}
       '';