提交 dc2ceed5 编写于 作者: N nicolargo

Error with IP plugin (issue #651)

上级 d64dbe91
......@@ -65,15 +65,15 @@ class Plugin(GlancesPlugin):
# Update stats using the netifaces lib
try:
default_gw = netifaces.gateways()['default'][netifaces.AF_INET]
except KeyError:
logger.debug("Can not grab the default gateway")
except (KeyError, AttributeError) as e:
logger.debug("Can not grab the default gateway ({})".format(e))
else:
try:
self.stats['address'] = netifaces.ifaddresses(default_gw[1])[netifaces.AF_INET][0]['addr']
self.stats['mask'] = netifaces.ifaddresses(default_gw[1])[netifaces.AF_INET][0]['netmask']
self.stats['mask_cidr'] = self.ip_to_cidr(self.stats['mask'])
self.stats['gateway'] = netifaces.gateways()['default'][netifaces.AF_INET][0]
except KeyError as e:
except (KeyError, AttributeError) as e:
logger.debug("Can not grab IP information (%s)".format(e))
elif self.input_method == 'snmp':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册