]> git.openstreetmap.org Git - chef.git/commitdiff
Override network speed to virtio interfaces
authorTom Hughes <tom@compton.nu>
Sun, 9 Oct 2016 21:25:49 +0000 (22:25 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 9 Oct 2016 21:31:49 +0000 (22:31 +0100)
cookbooks/munin/recipes/default.rb
cookbooks/munin/templates/default/if.erb [new file with mode: 0644]

index 677d79d5ea3a1cb8e148df88df3bda1c58f44fc4..fb98079315f593c6c5a70350ad3e54815067a2be 100644 (file)
@@ -162,6 +162,17 @@ end
 
 node[:network][:interfaces].each do |ifname, ifattr|
   if ifattr[:encapsulation] == "Ethernet" && ifattr[:state] == "up"
+    if 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
diff --git a/cookbooks/munin/templates/default/if.erb b/cookbooks/munin/templates/default/if.erb
new file mode 100644 (file)
index 0000000..1f36d50
--- /dev/null
@@ -0,0 +1,4 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+[if_<%= @ifname %>]
+env.speed 1000