Module: check_mk
Branch: master
Commit: b543c7a8dfe900abc9c8c2040dbd6d6c7693852e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b543c7a8dfe900…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Tue Jul 22 15:28:24 2014 +0200
qlogic_fcport: Changing Port IDs in a way to directly match port IDs from the management
interface of the device
---
checks/qlogic_fcport | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/checks/qlogic_fcport b/checks/qlogic_fcport
index 5198cce..17279d6 100644
--- a/checks/qlogic_fcport
+++ b/checks/qlogic_fcport
@@ -29,6 +29,14 @@
qlogic_fcport_inventory_opstates = [ "1", "3" ]
qlogic_fcport_inventory_admstates = [ "1", "3" ]
+# this function is needed to have the same port IDs in Check_MK
+# as within the Management interface of the device
+def qlogic_fcport_generate_port_id(port_id):
+ major, minor = port_id.split(".", 1)
+ minor = int(minor) - 1
+ port_id = "%s.%s" % (major, minor)
+ return port_id
+
def inventory_qlogic_fcport(info):
inventory = []
@@ -41,7 +49,7 @@ def inventory_qlogic_fcport(info):
if admin_status in qlogic_fcport_inventory_admstates and \
oper_status in qlogic_fcport_inventory_opstates:
- inventory.append( (port_id, None) )
+ inventory.append( (qlogic_fcport_generate_port_id(port_id), None) )
return inventory
@@ -54,6 +62,7 @@ def check_qlogic_fcport(item, params, info):
c2_discards, c2_fbsy_frames, c2_frjt_frames, c3_in_frames, \
c3_out_frames, c3_in_octets, c3_out_octets, c3_discards in info:
+ port_id = qlogic_fcport_generate_port_id(port_id)
if port_id == item:
status = 0
perfdata = []