]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/recipes/default.rb
Fix SMART monitoring of nvme devices
[chef.git] / cookbooks / hardware / recipes / default.rb
index c281c7fc8e7ef91b2fc5e5677499d0ac75a2cbee..bd525babff6d0e67e80a1ca88ffd5866e188af4a 100644 (file)
@@ -353,6 +353,9 @@ disks = disks.map do |disk|
         munin = "#{device}-#{Regexp.last_match(1)}:#{Regexp.last_match(2)}"
       end
     end
+  elsif disk[:device] =~ %r{^/dev/(nvme\d+)n\d+$}
+    device = Regexp.last_match(1)
+    munin = device
   elsif disk[:device]
     device = disk[:device].sub("/dev/", "")
     munin = device
@@ -368,7 +371,7 @@ disks = disks.map do |disk|
   ]
 end
 
-disks = disks.compact
+disks = disks.compact.uniq
 
 if disks.count.positive?
   package "smartmontools"