]> git.openstreetmap.org Git - chef.git/commitdiff
Manage all ethernet interfaces for munin, regardless of name
authorTom Hughes <tom@compton.nu>
Thu, 29 Jan 2015 20:46:04 +0000 (20:46 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 29 Jan 2015 20:48:04 +0000 (20:48 +0000)
cookbooks/munin/recipes/default.rb

index 847425e539f4aed4b430322cb4a122d0158ba918..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