Configure munin monitoring of sensors
authorTom Hughes <tom@compton.nu>
Fri, 31 May 2013 18:06:58 +0000 (19:06 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 31 May 2013 18:06:58 +0000 (19:06 +0100)
cookbooks/munin/recipes/default.rb

index 775acc095adc9aa26a838c7c23456c19de33e955..fca04dfebf315a19804722d73d310e60211b921d 100644 (file)
@@ -231,7 +231,41 @@ munin_plugin "processes"
 munin_plugin "proc_pri"
 # renderd_
 # replication_delay
-# sensors_
+
+Dir.glob("/sys/class/hwmon/hwmon*").each do |hwmon|
+  hwmon = "#{hwmon}/device" unless File.exists?("#{hwmon}/name")
+
+  if Dir.glob("#{hwmon}/fan*_input").empty?
+    munin_plugin "sensors_fan" do
+      action :delete
+    end
+  else
+    munin_plugin "sensors_fan" do
+      target "sensors_"
+    end
+  end
+
+  if Dir.glob("#{hwmon}/temp*_input").empty?
+    munin_plugin "sensors_temp" do
+      action :delete
+    end
+  else
+    munin_plugin "sensors_temp" do
+      target "sensors_"
+    end
+  end
+
+  if Dir.glob("#{hwmon}/in*_input").empty?
+    munin_plugin "sensors_volt" do
+      action :delete
+    end
+  else
+    munin_plugin "sensors_volt" do
+      target "sensors_"
+    end
+  end
+end
+
 # smart_
 # squid_
 munin_plugin "swap"