Module: check_mk
Branch: master
Commit: cb660c13fa81d3ec4056bb5d9a832b678db803c3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cb660c13fa81d3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sun Nov 14 09:36:26 2010 +0100
if/if64: allow to ignore target speed
---
ChangeLog | 1 +
checkman/if | 3 ++-
checks/if | 7 +++----
checks/if64 | 2 +-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7c18255..7c08d82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,6 +42,7 @@
Checks & Agents:
* megaraid_pdisks: Using the real enclosure number as check item now
* if/if64: Added expected interface speed to warning output
+ * if/if64: Allow to ignore speed setting (set target speed to None)
* wut_webtherm: handle more variants of WuT Webtherms (thanks to Lefty)
* cisco_fan: Does not inventorize 'notPresent' sensors anymore. Improved
output
* cisco_power: Not using power source as threshold anymore. Improved output
diff --git a/checkman/if b/checkman/if
index 271b9ee..9e04cbf 100644
--- a/checkman/if
+++ b/checkman/if
@@ -42,7 +42,8 @@ err_warn (float): The percentage of errors + discards at which a warning
should
triggered. Default is {0.01} percent (one of 10.000).
err_crit (float): The percentage of errors + discards at which a critical state is
reached. Default is {0.1} percent (one of 1.000).
-targetspeed (int): The target speed in bits per second of the interface.
+targetspeed (int): The target speed in bits per second of the interface. You can set this
to {None} if you
+ do not want to check for a certain speed setting.
bw_warn (float): Optional: The in/out rate to raise a WARNING state. Defaults to {None}.
bw_crit (float): Optional: The in/out rate to raise a CRITICAL state. Defaults to
{None}.
allowed_operstates (tuple): Optional: A list of allowed operstates. All other states
diff --git a/checks/if b/checks/if
index e08c247..fe903bc 100644
--- a/checks/if
+++ b/checks/if
@@ -108,12 +108,11 @@ def check_if(item, params, info):
# Check speed
speed = saveint(ifSpeed)
+ infotext += get_nic_speed_human_readable(speed)
bandwidth = speed / 8.0 # in Bytes / sec
- if speed != targetspeed:
- infotext += "%s (wrong speed! expected: %s)" % (speed,
get_nic_speed_human_readable(targetspeed))
+ if not targetspeed is None and speed != targetspeed:
+ infotext += " (wrong speed! expected: %s)" %
get_nic_speed_human_readable(targetspeed)
state = 1
- else:
- infotext += get_bytes_human_readable(speed, 1000)+'it/s'
# Performance counters
this_time = time.time()
diff --git a/checks/if64 b/checks/if64
index 897787b..72be2eb 100644
--- a/checks/if64
+++ b/checks/if64
@@ -122,7 +122,7 @@ def check_if64(item, params, info):
speed = saveint(ifSpeed)
infotext += get_nic_speed_human_readable(speed)
bandwidth = speed / 8.0 # in Bytes / sec
- if speed != targetspeed:
+ if not targetspeed is None and speed != targetspeed:
infotext += " (wrong speed! expected: %s)" %
get_nic_speed_human_readable(targetspeed)
state = 1