Module: check_mk
Branch: master
Commit: 566b2206c878b0d13e803bf370ef893289bd1aa2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=566b2206c878b0…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Jul 30 14:18:36 2014 +0200
touchstone_cable_modem_fec: Changed check behavior
---
checkman/touchstone_cable_modem_fec | 2 +-
checks/touchstone_cable_modem_fec | 19 +++++++++++--------
web/plugins/wato/check_parameters.py | 15 ++++-----------
3 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/checkman/touchstone_cable_modem_fec b/checkman/touchstone_cable_modem_fec
index 4a62c65..0ebc7e9 100644
--- a/checkman/touchstone_cable_modem_fec
+++ b/checkman/touchstone_cable_modem_fec
@@ -5,7 +5,7 @@ license: GPL
distribution:
description:
This check monitors the Forward Error correction rate on Touchestone Cable Modems.
- It is possible to set levels for good, uncorrected and corrected packages.
+ It is possible to set levels in percent fir uncorrected and corrected packages.
item:
None
diff --git a/checks/touchstone_cable_modem_fec b/checks/touchstone_cable_modem_fec
index daca175..14bad63 100644
--- a/checks/touchstone_cable_modem_fec
+++ b/checks/touchstone_cable_modem_fec
@@ -25,9 +25,8 @@
# Boston, MA 02110-1301 USA.
factory_settings["touchstone_cable_modem_fec_default_levels"] = {
- "good" : ( 250000000000, 260000000000 ),
- "corrected" : ( 250000000000, 260000000000 ),
- "uncorrected" : ( 250000000000, 260000000000 ),
+ "corrected" : ( 25.0 , 30.0 ),
+ "uncorrected" : ( 25.0 , 30.0 ),
}
def inventory_touchstone_cable_modem_fec(info):
@@ -35,15 +34,19 @@ def inventory_touchstone_cable_modem_fec(info):
def check_touchstone_cable_modem_fec(_no_item, params, info):
fec = {}
- fec['good'], fec['corrected'], fec['uncorrected'] = map(int,
info[0])
- for what in ['good', 'corrected', 'uncorrected']:
+ good, fec['corrected'], fec['uncorrected'] = map(float, info[0])
+ fec['corrected_perc'] = ( fec['corrected'] / good ) * 100
+ fec['uncorrected_perc'] = ( fec['uncorrected'] / good ) * 100
+
+ for what in [ 'corrected', 'uncorrected' ]:
warn, crit = params[what]
state = 0
- if fec[what] >= crit:
+ if fec[what+"_perc"] >= crit:
state = 2
- elif fec[what] >= warn:
+ elif fec[what+"_perc"] >= warn:
state = 1
- yield state, "FEC %s at %s" % ( what, fec[what] ), [ ( what, fec[what],
warn, crit ) ]
+ yield state, "FEC %s at %.2f%%" % ( what, fec[what+"_perc"]
), [ ( what, fec[what], warn, crit ) ]
+ yield 0, "Total: %d codewords" % good, [('total', good )]
check_info["touchstone_cable_modem_fec"] = {
"check_function" : check_touchstone_cable_modem_fec,
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index a0cae68..6953a04 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1321,25 +1321,18 @@ register_check_parameters(
_("Forward error correction"),
Dictionary(
elements = [
- ( 'good', Tuple(
- title = _("Levels for good Packages"),
- elements = [
- Integer( title = _("Warning at"),
default_value="250000000000"),
- Integer( title = _("Critical at"),
default_value="260000000000"),
- ]
- )),
( 'corrected', Tuple(
title = _("Levels for corrected Packages"),
elements = [
- Integer( title = _("Warning at"),
default_value="250000000000"),
- Integer( title = _("Critical at"),
default_value="260000000000"),
+ Percentage( title = _("Warning at"), default_value =
25.0),
+ Percentage( title = _("Critical at"), default_value = 30.0
),
]
)),
( 'uncorrected', Tuple(
title = _("Levels for uncorrected Packages"),
elements = [
- Integer( title = _("Warning at"),
default_value="250000000000"),
- Integer( title = _("Critical at"),
default_value="260000000000"),
+ Percentage( title = _("Warning at"), default_value = 25.0
),
+ Percentage( title = _("Critical at"), default_value = 30.0
),
]
)),
]