Module: check_mk
Branch: master
Commit: 27a754eb6a247f9b43b71309bcefb3a0b7831563
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=27a754eb6a247f…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Thu Aug 14 11:54:30 2014 +0200
#0644 adva_fsp_if: instead of lower warning and critical levels check now supports lower
and upper levels
---
.werks/644 | 9 +++++
ChangeLog | 2 ++
checkman/adva_fsp_if | 8 ++---
checks/adva_fsp_if | 66 ++++++++++++----------------------
web/plugins/wato/check_parameters.py | 12 +++----
5 files changed, 42 insertions(+), 55 deletions(-)
diff --git a/.werks/644 b/.werks/644
new file mode 100644
index 0000000..ee1b0f0
--- /dev/null
+++ b/.werks/644
@@ -0,0 +1,9 @@
+Title: adva_fsp_if: instead of lower warning and critical levels check now supports lower
and upper levels
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.5i6
+Date: 1408009839
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 3075ccb..2cf9c9e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,8 @@
NOTE: Please refer to the migration notes!
* 1174 rms200_temp: New Temperature check for RMS200 Devices
* 1175 dell_idrac_disks: New Check for Harddisks using Dell iDrac
+ * 0644 adva_fsp_if: instead of lower warning and critical levels check now supports
lower and upper levels
+ NOTE: Please refer to the migration notes!
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
diff --git a/checkman/adva_fsp_if b/checkman/adva_fsp_if
index e0c2eca..4f0f5c4 100644
--- a/checkman/adva_fsp_if
+++ b/checkman/adva_fsp_if
@@ -11,7 +11,7 @@ description:
{ifOperStatus}. Laser information is collected from the FspR7-MIB parameters
{currentPmSnapshotOutputPower} and {currentPmSnapshotInputPower}.
- Lower warning and critical limits can be configured for the input (received)
+ Lower and upper critical limits can be configured for the input (received)
and output (transmit) power of the laser. Per default, not limits are imposed,
since meaningful values depend on the type of interface.
@@ -39,10 +39,8 @@ inventory:
[parameters]
parameters (dict):
- {"min_input_power"}: a tuple of warning and critical values in dBm,
- default is (None, None)
- {"min_output_power"}: a tuple of warning and critical values in dBm,
- default is (None, None)
+ {"limits_input_power"}: a tuple of lower and upper critical values in
dBm,
+ {"limits_output_power"}: a tuple of lower and upper critical values in
dBm
[configuration]
adva_fsp_if_inventory_porttypes (list of strings): List of interface types the inventory
should create checks for.
diff --git a/checks/adva_fsp_if b/checks/adva_fsp_if
index a5cdb4c..d436634 100644
--- a/checks/adva_fsp_if
+++ b/checks/adva_fsp_if
@@ -29,11 +29,6 @@ adva_fsp_if_inventory_portstates = [ '1' ]
adva_fsp_if_inventory_uses_description = True
adva_fsp_if_inventory_uses_alias = False
-factory_settings["adva_fsp_if_default_levels"] = {
- "min_output_power" : (None, None),
- "min_input_power" : (None, None),
-}
-
adva_fsp_if_operstates = {
"1": ("up", 0 ),
"2": ("down", 2 ),
@@ -60,7 +55,7 @@ def inventory_adva_fsp_if(info):
item = line[5]
else:
item = line[0]
- inventory.append( (item, "adva_fsp_if_default_levels") )
+ inventory.append( (item, {}) )
return inventory
def adva_fsp_if_getindex(item,info):
@@ -91,44 +86,28 @@ def check_adva_fsp_if(item, params, info):
statesym = ""
infotext = "Admin/Operational State: %s/%s %s" % ( admintxt,
opertxt, statesym )
- perfdata = []
-
- try:
- output_power = float(line[6])/10.0
- owarn, ocrit = params.get("min_output_power")
- if ocrit and output_power < ocrit:
- state = 2
- osym = "(!!)"
- elif owarn and output_power < owarn:
- state = max(1, state)
- osym = "(!)"
- else:
- osym = ""
- infotext += ", Output Power: %.1f%s" % ( output_power, osym )
- perfdata.append( ("output_power",
str(output_power)+"dBm", str(owarn)+":", str(ocrit)+":") )
- except:
- if not re.match("S", item): # service interface does not have
power parameter
- infotext += ", Output Power: n.a. (!)"
- state = max(1,state)
-
+ perfdata = []
+ print line[6], line[7]
+ for power, name in [ (line[6], "output"),
+ (line[7], "input" )
+ ]:
+ try:
+ sym = ""
+ climits = ""
+ fpower = float(power)/10.0
+ if params.get("limits_%s_power" % name):
+ lower, upper = params.get("limits_%s_power" % name)
+ climits = "%s:%s" %
params.get("limits_%s_power" % name)
+ if fpower < lower or fpower > upper:
+ state = 2
+ sym = "(!!)"
+ infotext += ", %s Power: %.1f%s" % (name.title(), fpower,
sym )
+ perfdata.append( ("%s_power" % name, "%.1fdBm" %
fpower, "", climits ) )
- try:
- input_power = float(line[7])/10.0
- iwarn, icrit = params.get("min_input_power")
- if icrit and input_power < icrit:
- state = 2
- isym = "(!!)"
- elif iwarn and input_power < iwarn:
- state = max(1, state)
- isym = "(!)"
- else:
- isym = ""
- infotext += ", Input Power: %.1f%s" % ( input_power, isym )
- perfdata.append( ("input_power",
str(input_power)+"dBm", str(iwarn)+":", str(icrit)+":") )
- except:
- if not re.match("S", item): # service interface does not have
power parameter
- infotext += ", Input Power: n.a. (!)"
- state = max(1,state)
+ except:
+ if not re.match("S", item): # if no service interface and
no power parameter
+ infotext += ", %s Power: n.a. (!)" % name.title()
+ state = max(1,state)
return(state, infotext, perfdata)
@@ -141,7 +120,6 @@ check_info['adva_fsp_if'] = {
"service_description" : "Interface %s",
"has_perfdata" : True,
"group" : "adva_ifs",
- "default_levels_variable" : "adva_fsp_if_default_levels",
"snmp_info" : ( ".1.3.6.1",
[ "2.1.2.2.1.1", # ifIndex
"2.1.2.2.1.2", # ifDescr
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 6f2363c..4a69f77 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -5747,20 +5747,20 @@ register_check_parameters(
_("Adva Optical Transport Laser Power"),
Dictionary(
elements = [
- ( "min_output_power",
+ ( "limits_output_power",
Tuple(
title = _("Sending Power"),
elements = [
- Float(title = _("warning if below"), unit =
"dBm", default_value = None),
- Float(title = _("critical if below"), unit =
"dBm", default_value = None),
+ Float(title = _("lower limit"), unit = "dBm"),
+ Float(title = _("upper limit"), unit = "dBm"),
])
),
- ( "min_input_power",
+ ( "limits_input_power",
Tuple(
title = _("Received Power"),
elements = [
- Float(title = _("warning if below"), unit =
"dBm", default_value = None),
- Float(title = _("critical if below"), unit =
"dBm", default_value = None),
+ Float(title = _("lower limit"), unit = "dBm"),
+ Float(title = _("upper limit"), unit = "dBm"),
])
),
]