From 7254fd5015a4c44b364202985bcbbd0ccca810f3 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 31 May 2013 19:06:58 +0100 Subject: [PATCH] Configure munin monitoring of sensors --- cookbooks/munin/recipes/default.rb | 36 +++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/cookbooks/munin/recipes/default.rb b/cookbooks/munin/recipes/default.rb index 775acc095..fca04dfeb 100644 --- a/cookbooks/munin/recipes/default.rb +++ b/cookbooks/munin/recipes/default.rb @@ -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" -- 2.43.2