Merge ~aluria/charm-nrpe:lp1783741 into ~nrpe-charmers/charm-nrpe:master

Proposed by Alvaro Uria
Status: Merged
Approved by: Xav Paice
Approved revision: 0285ed449a1574b0093fe9149e52b91d71da222a
Merge reported by: Xav Paice
Merged at revision: 0285ed449a1574b0093fe9149e52b91d71da222a
Proposed branch: ~aluria/charm-nrpe:lp1783741
Merge into: ~nrpe-charmers/charm-nrpe:master
Diff against target: 20 lines (+9/-0)
1 file modified
files/plugins/check_netlinks.py (+9/-0)
Reviewer Review Type Date Requested Status
Xav Paice (community) Approve
Review via email: mp+351346@code.launchpad.net

Commit message

Skip speed error when operstate is down

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Xav Paice (xavpaice) wrote :

LGTM

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 3988f0c9a517cb8d3e5a89a1bf1f8c3d1af137ca

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/files/plugins/check_netlinks.py b/files/plugins/check_netlinks.py
2index 59ae6d2..216f448 100755
3--- a/files/plugins/check_netlinks.py
4+++ b/files/plugins/check_netlinks.py
5@@ -40,6 +40,15 @@ def check_iface(iface, skiperror, crit_thr):
6 raise WarnError('WARNING: {} iface does not '
7 'exist'.format(iface))
8 return
9+ except OSError as e:
10+ if metric_key == 'speed' and 'Invalid argument' in str(e) \
11+ and crit_thr['operstate'] == 'down':
12+ FILTER = [f for f in FILTER if f != 'speed']
13+ continue
14+ else:
15+ raise CriticalError('CRITICAL: {} ({} returns '
16+ 'invalid argument)'.format(iface,
17+ metric_key))
18
19 if metric_key == 'operstate' and metric_value != 'up':
20 if metric_value != crit_thr['operstate']:

Subscribers

People subscribed via source and target branches