]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/recipes/default.rb
Merge remote-tracking branch 'github/pull/102'
[chef.git] / cookbooks / munin / recipes / default.rb
index 677d79d5ea3a1cb8e148df88df3bda1c58f44fc4..39085f0e2f8efc32a400440a05457fad4662ef7f 100644 (file)
@@ -162,6 +162,19 @@ end
 
 node[:network][:interfaces].each do |ifname, ifattr|
   if ifattr[:encapsulation] == "Ethernet" && ifattr[:state] == "up"
+    if node[:hardware] &&
+       node[:hardware][:network] &&
+       node[:hardware][:network][ifname][:device] =~ /^virtio/
+      munin_plugin_conf "if_#{ifname}" do
+        template "if.erb"
+        variables :ifname => ifname
+      end
+    else
+      munin_plugin_conf "if_#{ifname}" do
+        action :delete
+      end
+    end
+
     munin_plugin "if_err_#{ifname}" do
       target "if_err_"
     end
@@ -280,9 +293,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