From: Tom Hughes Date: Thu, 29 Jan 2015 20:46:04 +0000 (+0000) Subject: Manage all ethernet interfaces for munin, regardless of name X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/41140b569c7401130afc08c91554e57688ef9b91?ds=sidebyside Manage all ethernet interfaces for munin, regardless of name --- diff --git a/cookbooks/munin/recipes/default.rb b/cookbooks/munin/recipes/default.rb index 847425e53..ac6c4d843 100644 --- a/cookbooks/munin/recipes/default.rb +++ b/cookbooks/munin/recipes/default.rb @@ -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