]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/recipes/default.rb
Override network speed to virtio interfaces
[chef.git] / cookbooks / munin / recipes / default.rb
index fc457acdd5ff27f21ccb669134c0b1f89a218eef..fb98079315f593c6c5a70350ad3e54815067a2be 100644 (file)
@@ -17,8 +17,6 @@
 # limitations under the License.
 #
 
-include_recipe "networking"
-
 package "munin-node"
 
 service "munin-node" do
@@ -51,7 +49,7 @@ template "/etc/munin/munin-node.conf" do
   source "munin-node.conf.erb"
   owner "root"
   group "root"
-  mode 0644
+  mode 0o644
   variables :servers => servers
   notifies :restart, "service[munin-node]"
 end
@@ -60,10 +58,10 @@ remote_directory "/usr/local/share/munin/plugins" do
   source "plugins"
   owner "root"
   group "root"
-  mode 0755
+  mode 0o755
   files_owner "root"
   files_group "root"
-  files_mode 0755
+  files_mode 0o755
   purge true
 end
 
@@ -71,10 +69,10 @@ remote_directory "/etc/munin/plugin-conf.d" do
   source "plugin-conf.d"
   owner "root"
   group "munin"
-  mode 0750
+  mode 0o750
   files_owner "root"
   files_group "root"
-  files_mode 0644
+  files_mode 0o644
   purge false
   notifies :restart, "service[munin-node]"
 end
@@ -98,8 +96,13 @@ else
   end
 end
 
+munin_plugin_conf "df" do
+  template "df.erb"
+end
+
 munin_plugin "df"
 munin_plugin "df_inode"
+
 munin_plugin "diskstats"
 munin_plugin "entropy"
 munin_plugin "forks"
@@ -159,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