Module: check_mk
Branch: master
Commit: 4d370ad75e7d63b5a3c1cbe4ada9e261f796ea66
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4d370ad75e7d63…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon May 16 11:17:11 2011 +0200
brocade_port: ISL and port name in svcdescription
---
ChangeLog | 4 +++
checks/brocade_fcport | 42 ++++++++++++++++++++++++++------------
checks/fc_brocade_port_detailed | 3 +-
3 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d36fb1a..516e448 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
1.1.11i2:
Core, Setup, etc.:
* FIX: sort output of cmk --list-hosts alphabetically
+
+ Checks & Agents:
+ * brocade_port: check for Brocade FC ports has been rewritten with
+ lots of new features.
Multisite:
* Introduced basic infrastructure for multilanguage support in Multisite
diff --git a/checks/brocade_fcport b/checks/brocade_fcport
index d40c925..52f6cf8 100644
--- a/checks/brocade_fcport
+++ b/checks/brocade_fcport
@@ -26,7 +26,8 @@
# lookup tables for check implementation
-brocade_fcport_phystates = [ '', 'noCard', 'noTransceiver',
'laserFault', 'noLight', 'noSync', 'inSync',
'portFault', 'diagFault', 'lockRef' ]
+brocade_fcport_phystates = [ '', 'noCard', 'noTransceiver',
'laserFault', 'noLight',
+ 'noSync', 'inSync', 'portFault',
'diagFault', 'lockRef' ]
brocade_fcport_opstates = [ 'unknown', 'online', 'offline',
'testing', 'faulty' ]
brocade_fcport_admstates = [ '', 'online', 'offline',
'testing', 'faulty' ]
brocade_fcport_speed = [ '', '1Gbit', '2Gbit',
'auto-Neg', '4Gbit', '8Gbit', '10Gbit', ]
@@ -36,6 +37,8 @@ brocade_fcport_speed = [ '', '1Gbit',
'2Gbit', 'auto-Neg', '4Gbit', '8Gbit',
brocade_fcport_inventory_phystates = [ 3, 4, 5, 6, 7, 8, 9, ]
brocade_fcport_inventory_opstates = [ 1, 2, 3, 4, ]
brocade_fcport_inventory_admstates = [ 1, 3, 4, ]
+brocade_fcport_inventory_use_portname = True # use swFCPortName as part of service
description
+brocade_fcport_inventory_show_isl = True # add "ISL" to service description
for interswitch links
check_default_levels["brocade_fcport"] =
"brocade_fcport_default_levels"
@@ -45,13 +48,19 @@ factory_settings["brocade_fcport_default_levels"] = {
"rxencoutframes": (3.0, 20.0),
"notxcredits": (3.0, 20.0),
"c3discards": (3.0, 20.0),
- "assumed_speed": 2.0, } # used, if speed not available in SNMP
data
+ "assumed_speed": 2.0, # used, if speed not available in SNMP
data
+}
# Helper function for computing item from port number
-def brocade_fcport_getitem(ports, index):
+def brocade_fcport_getitem(ports, index, portname, is_isl):
int_len = str(len(str(len(ports))))
- return ("%0" + int_len + "d") % (index - 1)
+ itemname = ("%0" + int_len + "d") % (index - 1)
+ if is_isl and brocade_fcport_inventory_show_isl:
+ itemname += " ISL"
+ if portname.strip() and brocade_fcport_inventory_use_portname:
+ itemname += " " + portname.strip()
+ return itemname
def inventory_brocade_fcport(checkname, info):
@@ -64,17 +73,19 @@ def inventory_brocade_fcport(checkname, info):
isl_ports = dict(info[1])
for item in info[0]:
- if len(item) == 13:
+ if len(item) == 14:
index = int(item[0])
phystate = int(item[1])
opstate = int(item[2])
admstate = int(item[3])
+ portname = item[13]
+ is_isl = item[0] in isl_ports
if admstate in brocade_fcport_inventory_admstates and \
opstate in brocade_fcport_inventory_opstates and \
phystate in brocade_fcport_inventory_phystates:
- inventory.append(( brocade_fcport_getitem(info[0], index),
+ inventory.append(( brocade_fcport_getitem(info[0], index, portname, is_isl),
'{ "phystate": %d, "opstate": %d, "admstate": %d
}'
% (phystate, opstate, admstate) ))
@@ -82,16 +93,19 @@ def inventory_brocade_fcport(checkname, info):
def check_brocade_fcport(item, params, info):
-
- portinfo = [ line for line in info[0] if brocade_fcport_getitem(info[0],
int(line[0])) == item ]
+ # Accept item, even if port name or ISL state has changed
+ item_index = int(item.split()[0])
+ portinfo = [ line for line in info[0] if int(line[0]) == item_index ]
if len(portinfo) < 1:
return (3, "UNKOWN - Port not found in SNMP data")
-
+
+ isl_ports = dict(info[1])
+
# Prepare data, convert to int
index, phystate, opstate, admstate, txwords, rxwords, txframes, rxframes, \
- notxcredits, rxcrcs, rxencoutframes, c3discards, speed = map(int, portinfo[0])
- isl_ports = dict(info[1])
+ notxcredits, rxcrcs, rxencoutframes, c3discards, speed = map(int,
portinfo[0][:-1])
+
summarystate = 0
output = []
perfdata = []
@@ -114,7 +128,6 @@ def check_brocade_fcport(item, params, info):
# convert gbit netto link-rate to Byte/s (8/10 enc)
wirespeed = gbit * 0.8 * 1000000.0 / 8
-
# Now check rates of various error counters
this_time = time.time()
try:
@@ -281,6 +294,7 @@ snmp_info['brocade_fcport'] = [
26, # swFCPortRxEncOutFrs
28, # swFCPortC3Discards
35, # swFCPortSpeed
+ 36, # swFCPortName (not supported by all devices)
]),
# Information about Inter-Switch-Links (contains baud rate of port)
@@ -291,4 +305,6 @@ snmp_info['brocade_fcport'] = [
]
snmp_scan_functions['brocade_fcport'] = \
- lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.24.1.1588.2.1.1")
+ lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.1588.2.1.1") or \
+
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.24.1.1588.2.1.1")
+
diff --git a/checks/fc_brocade_port_detailed b/checks/fc_brocade_port_detailed
index 8eaa7b7..a56fc7c 100644
--- a/checks/fc_brocade_port_detailed
+++ b/checks/fc_brocade_port_detailed
@@ -223,5 +223,6 @@ snmp_info['fc_brocade_port_detailed'] = [
]
snmp_scan_functions['fc_brocade_port_detailed'] = \
- lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.1588.2.1.1.")
+ lambda oid: False # prefer new brocade_fcport
+ # lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.1588.2.1.1.")