Avoid exception when an interface has no flags
[chef.git] / cookbooks / munin / recipes / default.rb
index 677a62b323f7e914c46817013bca0d98d0ced190..3418d3e83b1843255ca6f44eed9d6096d099840f 100644 (file)
@@ -160,7 +160,7 @@ munin_plugin "http_loadtime" do
 end
 
 node[:network][:interfaces].each do |ifname, ifattr|
-  if ifattr[:encapsulation] == "Ethernet" && ifattr[:state] == "up"
+  if ifattr[:flags]&.include?("UP") && !ifattr[:flags].include?("LOOPBACK")
     if node[:hardware] &&
        node[:hardware][:network] &&
        node[:hardware][:network][ifname][:device] =~ /^virtio/