]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/recipes/default.rb
Manage all ethernet interfaces for munin, regardless of name
[chef.git] / cookbooks / munin / recipes / default.rb
index 03bcee613c92ca4202594a956e56b45b41890869..ac6c4d843558183e7bfba4de5fcd914a09ffbad2 100644 (file)
@@ -173,23 +173,21 @@ munin_plugin "http_loadtime" do
 end
 
 node[:network][:interfaces].each do |ifname,ifattr|
-  if ifname =~ /^eth\d+$/
-    if ifattr[:flags] and ifattr[:flags].include?("UP")
-      munin_plugin "if_err_#{ifname}" do
-        target "if_err_"
-      end
+  if ifattr[:encapsulation] == "Ethernet" and ifattr[:state] == "up"
+    munin_plugin "if_err_#{ifname}" do
+      target "if_err_"
+    end
 
-      munin_plugin "if_#{ifname}" do
-        target "if_"
-      end
-    else
-      munin_plugin "if_err_#{ifname}" do
-        action :delete
-      end
+    munin_plugin "if_#{ifname}" do
+      target "if_"
+    end
+  else
+    munin_plugin "if_err_#{ifname}" do
+      action :delete
+    end
 
-      munin_plugin "if_#{ifname}" do
-        action :delete
-      end
+    munin_plugin "if_#{ifname}" do
+      action :delete
     end
   end
 end
@@ -325,6 +323,8 @@ node[:block_device].each do |name,attributes|
   if attributes[:vendor] == "ATA"
     munin_plugin "smart_#{name}" do
       target "smart_"
+      conf "smart.erb"
+      conf_variables :disk => name
     end
   else
     munin_plugin "smart_#{name}" do