]> git.openstreetmap.org Git - chef.git/commitdiff
Configure HDD temperature monitoring for all directly attached disks
authorTom Hughes <tom@compton.nu>
Wed, 22 Jan 2014 00:41:00 +0000 (00:41 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 22 Jan 2014 00:43:05 +0000 (00:43 +0000)
cookbooks/munin/recipes/default.rb
cookbooks/munin/templates/default/hddtemp.erb [new file with mode: 0644]

index e83cac6f69690cc836e878c861a412d84defa02f..0f6c67d86b4bc55659e5036ae889f11698f09f5b 100644 (file)
@@ -124,7 +124,20 @@ else
   end
 end
 
-# hddtemp_smartctl
+disks = node[:block_device].select do |name,attributes|
+  [ "ATA", "FUJITSU", "SEAGATE", "DELL", "COMPAQ", "IBM-ESXS" ].include?(attributes[:vendor])
+end
+
+if disks.empty?
+  munin_plugin "hddtemp_smartctl" do
+    action :delete
+  end
+else
+  munin_plugin "hddtemp_smartctl" do
+    conf "hddtemp.erb"
+    conf_variables :disks => disks
+  end
+end
 
 if File.exists?("/sbin/hpasmcli")
   munin_plugin "hpasmcli_temp"
diff --git a/cookbooks/munin/templates/default/hddtemp.erb b/cookbooks/munin/templates/default/hddtemp.erb
new file mode 100644 (file)
index 0000000..36a8bb5
--- /dev/null
@@ -0,0 +1,4 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+[hddtemp_smartctl]
+env.drives <%= @disks.keys.sort.join(" ") %>