Module: check_mk
Branch: master
Commit: 4a39eec9eb4e05d5551f80dbfedf0f6414ee12b3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4a39eec9eb4e05…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Jun 27 16:27:26 2016 +0200
3685 FIX brocade_fcport: fixed unknown state texts
---
.werks/3685 | 10 +++++++++
ChangeLog | 1 +
checks/brocade_fcport | 58 ++++++++++++++++++++++++++++++++++++++++---------
3 files changed, 59 insertions(+), 10 deletions(-)
diff --git a/.werks/3685 b/.werks/3685
new file mode 100644
index 0000000..dcced1a
--- /dev/null
+++ b/.werks/3685
@@ -0,0 +1,10 @@
+Title: brocade_fcport: fixed unknown state texts
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1467037616
+
+
diff --git a/ChangeLog b/ChangeLog
index 5ba0426..a965c56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -284,6 +284,7 @@
* 3147 FIX: windows agent: fixed bug where all placeholders in messages were replaced
with the same parameter
* 3654 FIX: apc_symmetra: Improved output in case of unknown battery state /
calibration result
* 3655 FIX: if64adm: Can now be used with OID range limits
+ * 3685 FIX: brocade_fcport: fixed unknown state texts
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/checks/brocade_fcport b/checks/brocade_fcport
index 05a64d1..1969573 100644
--- a/checks/brocade_fcport
+++ b/checks/brocade_fcport
@@ -26,15 +26,53 @@
# lookup tables for check implementation
# Taken from swFCPortPhyState
-brocade_fcport_phystates = [ '', 'noCard', 'noTransceiver',
'laserFault', 'noLight',
- 'noSync', 'inSync', 'portFault',
'diagFault', 'lockRef',
- 'validating', 'invalidModule',
'noSigDet', 'unkown' ]
+brocade_fcport_phystates = {
+ 0 : '',
+ 1 : 'noCard',
+ 2 : 'noTransceiver',
+ 3 : 'laserFault',
+ 4 : 'noLight',
+ 5 : 'noSync',
+ 6 : 'inSync',
+ 7 : 'portFault',
+ 8 : 'diagFault',
+ 9 : 'lockRef',
+ 10 : 'validating',
+ 11 : 'invalidModule',
+ 12 : 'noSigDet',
+ 13 : 'unkown',
+}
+
# Taken from swFCPortOpStatus
-brocade_fcport_opstates = [ 'unknown', 'online', 'offline',
'testing', 'faulty' ]
+brocade_fcport_opstates = {
+ 0 : 'unknown',
+ 1 : 'online',
+ 2 : 'offline',
+ 3 : 'testing',
+ 4 : 'faulty',
+}
+
# Taken from swFCPortAdmStatus
-brocade_fcport_admstates = [ '', 'online', 'offline',
'testing', 'faulty' ]
+brocade_fcport_admstates = {
+ 0 : '',
+ 1 : 'online',
+ 2 : 'offline',
+ 3 : 'testing',
+ 4 : 'faulty',
+}
+
# Taken from swFCPortSpeed
-brocade_fcport_speed = [ 'unknown', '1Gbit', '2Gbit',
'auto-Neg', '4Gbit', '8Gbit', '10Gbit', 'unknown',
'16Gbit' ]
+brocade_fcport_speed = {
+ 0 : 'unknown',
+ 1 : '1Gbit',
+ 2 : '2Gbit',
+ 3 : 'auto-Neg',
+ 4 : '4Gbit',
+ 5 : '8Gbit',
+ 6 : '10Gbit',
+ 7 : 'unknown',
+ 8 : '16Gbit',
+}
# Taken from swNbBaudRate
isl_speed = {
@@ -139,7 +177,7 @@ def check_brocade_fcport(item, params, info):
gbit = isl_speed.get( isl_ports.get( str(index) ) )
speedmsg = ("ISL at %.0fGbit/s" % gbit)
else: # no ISL port
- if brocade_fcport_speed[speed] in [ "auto-Neg", "unknown" ]:
+ if brocade_fcport_speed.get(speed, "unknown") in [
"auto-Neg", "unknown" ]:
try:
# extract the speed from IF-MIB::ifHighSpeed.
# unfortunately ports in the IF-MIB and the brocade MIB
@@ -289,7 +327,7 @@ def check_brocade_fcport(item, params, info):
else:
errorflag = "(!!)"
summarystate = 2
- output.append("Phy:%s(%d)%s" % (brocade_fcport_phystates[phystate],
phystate, errorflag))
+ output.append("Phy:%s(%d)%s" % (brocade_fcport_phystates.get(phystate,
"unknown"), phystate, errorflag))
errorflag = ""
#unknown(0) online(1) offline(2) testing(3) faulty(4) ]
@@ -301,7 +339,7 @@ def check_brocade_fcport(item, params, info):
else:
errorflag = "(!!)"
summarystate = 2
- output.append("Op:%s(%d)%s" % (brocade_fcport_opstates[opstate], opstate,
errorflag))
+ output.append("Op:%s(%d)%s" % (brocade_fcport_opstates.get(opstate,
"unknown"), opstate, errorflag))
errorflag = ""
# online(1) offline(2) testing(3) faulty(4)
@@ -313,7 +351,7 @@ def check_brocade_fcport(item, params, info):
else:
errorflag = "(!!)"
summarystate = 2
- output.append("Adm:%s(%d)%s" % (brocade_fcport_admstates[admstate],
admstate, errorflag))
+ output.append("Adm:%s(%d)%s" % (brocade_fcport_admstates.get(admstate,
"unknown"), admstate, errorflag))
return (summarystate, ', '.join(output), perfdata)