Module: check_mk
Branch: master
Commit: abea3de65901e8ea9fc3cf2526b5f2654be087b8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=abea3de65901e8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jun 20 16:42:54 2011 +0200
FIX: lnx_if/if/if64: ignore perc. levels on NICs without speed info
---
ChangeLog | 2 ++
checks/if.include | 31 +++++++++++++++++++++++--------
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b1f0a39..08aaceb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@
* FIX: apc_symmetra: fix remaining runtime calculation (by factor 100)
* FIX: Added PNP-template for winperf_phydisk
* FIX: if64: fix UNKNOWN in case of non-unique ifAlias
+ * FIX: lnx_if/if/if64: ignore percentual traffic levels on NICs without
+ speed information.
* brocade_port: check for Brocade FC ports has been rewritten with
lots of new features.
* AIX agent now simulates <<<netctr>>> output (by Jörg Linge)
diff --git a/checks/if.include b/checks/if.include
index e4893cd..8213c17 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -177,14 +177,8 @@ def check_if_common(item, params, info):
infotext += "(%s) " % operstatus
- # Check speed
+ # prepare reference speed for computing relative bandwidth usage
speed = saveint(ifSpeed)
- infotext += get_nic_speed_human_readable(speed)
- if not targetspeed is None and speed != targetspeed:
- infotext += " (wrong speed! expected: %s)" %
get_nic_speed_human_readable(targetspeed)
- state = max(state, 1)
-
- # convert percentages to absolute values and vice verca - if possible
if speed:
ref_speed = speed / 8.0
elif targetspeed:
@@ -192,13 +186,34 @@ def check_if_common(item, params, info):
else:
ref_speed = None
- # convert percentages to absolute values if reference speed available
+ # Check speed settings of interface, but only if speed information
+ # is available. This is not always the case.
+ if speed:
+ infotext += get_nic_speed_human_readable(speed)
+ if not targetspeed is None and speed != targetspeed:
+ infotext += " (wrong speed! expected: %s)" %
get_nic_speed_human_readable(targetspeed)
+ state = max(state, 1)
+ elif targetspeed:
+ infotext += "assuming %s" %
get_nic_speed_human_readable(targetspeed)
+ else:
+ infotext += "speed unknown"
+
+ # convert percentages to absolute values if levels are float
+ # this is only possible if a reference speed is available.
if ref_speed:
if bw_warn != None and type(bw_warn) == float:
bw_warn = bw_warn / 100.0 * ref_speed
if bw_crit != None and type(bw_crit) == float:
bw_crit = bw_crit / 100.0 * ref_speed
+ # Ignore percentual levels if no reference speed is available
+ else:
+ if bw_warn != None and type(bw_warn) == float:
+ bw_warn = None
+
+ if bw_crit != None and type(bw_crit) == float:
+ bw_crit = None
+
# Performance counters
this_time = time.time()
rates = []