]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/recipes/default.rb
Don't rely on ohai hardware plugin having been run
[chef.git] / cookbooks / munin / recipes / default.rb
index fb98079315f593c6c5a70350ad3e54815067a2be..1b4ae6d75d857346292d4eb89a4170cba741e7d1 100644 (file)
@@ -162,7 +162,7 @@ end
 
 node[:network][:interfaces].each do |ifname, ifattr|
   if ifattr[:encapsulation] == "Ethernet" && ifattr[:state] == "up"
-    if node[:hardware][:network][ifname][:device] =~ /^virtio/
+    if node[:hardware] && node[:hardware][:network][ifname][:device] =~ /^virtio/
       munin_plugin_conf "if_#{ifname}" do
         template "if.erb"
         variables :ifname => ifname
@@ -291,9 +291,7 @@ Dir.glob("/sys/class/hwmon/hwmon*").each do |hwmon|
   sensors_volt = true unless Dir.glob("#{hwmon}/in*_input").empty?
 end
 
-if sensors_fan || sensors_temp || sensors_volt
-  package "lm-sensors"
-end
+package "lm-sensors" if sensors_fan || sensors_temp || sensors_volt
 
 if sensors_fan
   munin_plugin "sensors_fan" do