Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[network] Really skip excluded_interfaces #1260

Merged
merged 1 commit into from
Jan 5, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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