Module: check_mk
Branch: master
Commit: b8dcb4d2b5a44a555f903340a4d0080e7b5bec90
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b8dcb4d2b5a44a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Nov 21 11:06:27 2013 +0100
FIX Interface Checks: Counters are now skipped when interface is down
In most cases it was no problem to check the counter values, as they
are reset to zero for most devices. But for some devices, the counters
are still having values - and maybe also change. To handle this, we
simply ignore the counter values for down interfaces.
---
.werks/233 | 11 +++++++++++
ChangeLog | 1 +
checks/if.include | 8 ++++++++
3 files changed, 20 insertions(+)
diff --git a/.werks/233 b/.werks/233
new file mode 100644
index 0000000..2f8d076
--- /dev/null
+++ b/.werks/233
@@ -0,0 +1,11 @@
+Title: Interface Checks: Counters are now skipped when interface is down
+Level: 1
+Component: checks
+Version: 1.2.3i7
+Date: 1385028294
+Class: fix
+
+In most cases it was no problem to check the counter values, as they
+are reset to zero for most devices. But for some devices, the counters
+are still having values - and maybe also change. To handle this, we
+simply ignore the counter values for down interfaces.
diff --git a/ChangeLog b/ChangeLog
index f4953e8..fe66ca4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,7 @@
* 0209 FIX: Cleaned up bad code in fileinfo.groups check
* 0003 FIX: ps: Remove exceeding [ and ] in service description when using process
inventory...
* 0037 FIX: checkman: alcatel power - now with correct classification...
+ * 0233 FIX: Interface Checks: Counters are now skipped when interface is down...
Multisite:
* 0001 New filters for selecting several host/service-groups at once...
diff --git a/checks/if.include b/checks/if.include
index edf9723..54938e4 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -444,6 +444,14 @@ def check_if_common_single(item, params, info, force_counter_wrap =
False):
speed_b_in = assumed_speed_in and assumed_speed_in / 8 or ref_speed
speed_b_out = assumed_speed_out and assumed_speed_out / 8 or ref_speed
+ # When the interface is reported as down, there is no need to try to handle,
+ # the performance counters. Most devices do reset the counter values to
zero,
+ # but we spotted devices, which do report error packes even for down
interfaces.
+ # To deal with it, we simply skip over all performance counter checks for
down
+ # interfaces.
+ if operstatus == "down":
+ return state, infotext
+
# Performance counters
this_time = time.time()
rates = []