Module: check_mk
Branch: master
Commit: 11575c7db70ddca435f7f92c266cfaa21c8d0ee9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=11575c7db70ddc…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Tue Jul 1 16:15:26 2014 +0200
FIX: missing laser power information is ignored for service interfaces
---
checkman/adva_fsp_if | 4 ++++
checks/adva_fsp_if | 18 ++++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/checkman/adva_fsp_if b/checkman/adva_fsp_if
index dac243f..e0c2eca 100644
--- a/checkman/adva_fsp_if
+++ b/checkman/adva_fsp_if
@@ -15,6 +15,10 @@ description:
and output (transmit) power of the laser. Per default, not limits are imposed,
since meaningful values depend on the type of interface.
+ A {WARN} state is triggered if no laser power information can be found.
+ Service interfaces (item name beginning with "S") do not have laser power
+ information, so that non-existent laser power information is ignored for these
+ interfaces.
item:
There are three allowed ways to specify an interface: {1}: the last component
diff --git a/checks/adva_fsp_if b/checks/adva_fsp_if
index 8a8c854..a5cdb4c 100644
--- a/checks/adva_fsp_if
+++ b/checks/adva_fsp_if
@@ -80,9 +80,9 @@ def check_adva_fsp_if(item, params, info):
if line[0] == index:
state = 0
admintxt, adminstate = adva_fsp_if_adminstates[line[3]]
- state = max(adminstate,state)
+ state = max(adminstate, state)
opertxt, operstate = adva_fsp_if_operstates[line[4]]
- state = max(operstate,state)
+ state = max(operstate, state)
if state == 2:
statesym = "(!!)"
elif state == 1:
@@ -100,15 +100,16 @@ def check_adva_fsp_if(item, params, info):
state = 2
osym = "(!!)"
elif owarn and output_power < owarn:
- state = max(1,state)
+ 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:
- infotext += ", Output Power: n.a. (!)"
- state = max(1,state)
+ if not re.match("S", item): # service interface does not have
power parameter
+ infotext += ", Output Power: n.a. (!)"
+ state = max(1,state)
try:
@@ -118,15 +119,16 @@ def check_adva_fsp_if(item, params, info):
state = 2
isym = "(!!)"
elif iwarn and input_power < iwarn:
- state = max(1,state)
+ 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:
- infotext += ", Input Power: n.a. (!)"
- state = max(1,state)
+ if not re.match("S", item): # service interface does not have
power parameter
+ infotext += ", Input Power: n.a. (!)"
+ state = max(1,state)
return(state, infotext, perfdata)