Skip to content

Commit

Permalink
Merge pull request #1260 from sirlantis/patch-1
Browse files Browse the repository at this point in the history
[network] Really skip excluded_interfaces
  • Loading branch information
LeoCavaille committed Jan 5, 2015
2 parents e9c1b70 + 93819c2 commit e18cb49
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions checks.d/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def check(self, instance):
self._check_solaris(instance)

def _submit_devicemetrics(self, iface, vals_by_metric):
if self._exclude_iface_re and self._exclude_iface_re.match(iface):
if iface in self._excluded_ifaces or (self._exclude_iface_re and self._exclude_iface_re.match(iface)):
# Skip this network interface.
return False

Expand All @@ -98,27 +98,12 @@ def _submit_devicemetrics(self, iface, vals_by_metric):
assert m in vals_by_metric
assert len(vals_by_metric) == len(expected_metrics)

# For reasons i don't understand only these metrics are skipped if a
# particular interface is in the `excluded_interfaces` config list.
# Not sure why the others aren't included. Until I understand why, I'm
# going to keep the same behaviour.
exclude_iface_metrics = [
'packets_in.count',
'packets_in.error',
'packets_out.count',
'packets_out.error',
]

count = 0
for metric, val in vals_by_metric.iteritems():
if iface in self._excluded_ifaces and metric in exclude_iface_metrics:
# skip it!
continue
self.rate('system.net.%s' % metric, val, device_name=iface)
count += 1
self.log.debug("tracked %s network metrics for interface %s" % (count, iface))


def _parse_value(self, v):
if v == "-":
return 0
Expand Down

0 comments on commit e18cb49

Please sign in to comment.