Module: check_mk
Branch: master
Commit: 40e5f042c3a1a80f16ba4ea8461672c68fed7db5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=40e5f042c3a1a8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Jan 22 14:20:58 2014 +0100
Internal code cleanup of hitachi_hnas_fc_if
---
checks/hitachi_hnas_fc_if | 68 +++++++++++++++++++--------------------------
1 file changed, 29 insertions(+), 39 deletions(-)
diff --git a/checks/hitachi_hnas_fc_if b/checks/hitachi_hnas_fc_if
index b8a1821..f30ac6f 100644
--- a/checks/hitachi_hnas_fc_if
+++ b/checks/hitachi_hnas_fc_if
@@ -24,42 +24,32 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
def hitachi_hnas_fc_if_convert_info(info):
converted = []
for line in info:
- convertedline = []
- convertedline.append("%d%03d" % (int(line[0]), int(line[1]))) #
ifIndex
- # use ClusterNode.InterfaceIndex as description too, because
- # we have no explicit Descr
- convertedline.append(line[0] + "." + line[1]) # ifDescr
- # ifType 56 fibreChannel
- convertedline.append("56") # ifType
- convertedline.append(str(int(line[3]) * 1000000000)) # ifHighSpeed
- if line[2] == "1": # ifOperStatus
- convertedline.append("1")
- else:
- convertedline.append("2")
- convertedline.append(line[4]) # ifHCInOctets
- convertedline.append("0") # ifHCInUcastPkts
- convertedline.append("0") #
ifHCInMulticastPkts
- convertedline.append("0") # ifHCInBroadcastPkts
- convertedline.append(line[11]) # ifInDiscards
- convertedline.append(str(int(line[6]) + int(line[7]) + int(line[8]) \
- + int(line[9]) + int(line[10]) + int(line[12]) + int(line[13])))
- # ifInErrors
- convertedline.append(line[5]) # ifHCOutOctets
- convertedline.append("0") # ifHCOutUcastPkts
- convertedline.append("0") #
ifHCOutMulticastPkts
- convertedline.append("0") #
ifHCOutBroadcastPkts
- convertedline.append("0") # ifOutDiscards
- convertedline.append("0") # ifOutErrors
- convertedline.append("0") # ifOutQLen
- # use ClusterNode.InterfaceIndex as alias too, because
- # we have no explicit alias
- convertedline.append(line[0] + "." + line[1]) # ifAlias
- convertedline.append("") # ifPhysAddress
-
- converted.append(convertedline)
+ converted.append(map(str, [
+ "%d%03d" % (int(line[0]), int(line[1])), # ifIndex
+ line[0] + "." + line[1], # ifDescr (use
ClusterNode.InterfaceIndex)
+ 56, # ifType 56 (fibreChannel)
+ int(line[3]) * 1000000000, # ifHighSpeed
+ line[2] == "1" and 1 or 2, # ifOperStatus (map
other states to down)
+ line[4], # ifHCInOctets
+ 0, # ifHCInUcastPkts
+ 0, # ifHCInMulticastPkts
+ 0, # ifHCInBroadcastPkts
+ line[13], # ifInDiscards
+ sum(map(int, line[6:13])), # ifInErrors
+ line[5], # ifHCOutOctets
+ 0, # ifHCOutUcastPkts
+ 0, # ifHCOutMulticastPkts
+ 0, # ifHCOutBroadcastPkts
+ 0, # ifOutDiscards
+ 0, # ifOutErrors
+ 0, # ifOutQLen
+ line[0] + "." + line[1], # ifAlias, same as
description
+ "", # ifPhysAddress
+ ]))
return converted
def inventory_hitachi_hnas_fc_if(info):
@@ -69,12 +59,11 @@ def inventory_hitachi_hnas_fc_if(info):
def check_hitachi_hnas_fc_if(item, params, info):
converted = hitachi_hnas_fc_if_convert_info(info)
return check_if_common(item, params, converted)
-
+
check_info["hitachi_hnas_fc_if"] = {
"check_function" : check_hitachi_hnas_fc_if,
"inventory_function" : inventory_hitachi_hnas_fc_if,
- "includes": [ "if.include" ],
"service_description" : "Interface FC %s",
"has_perfdata" : True,
"snmp_info" :
(".1.3.6.1.4.1.11096.6.1.1.1.3.6.25.1", [
@@ -89,12 +78,13 @@ check_info["hitachi_hnas_fc_if"] = {
15, # fcStatsLossSyncErrors 8
16, # fcStatsLinkFailErrors 9
17, # fcStatsRXEOFErrors 10
- 18, # fcStatsDiscardedFrameErrors 11
- 19, # fcStatsBadCRCErrors 12
- 20, # fcStatsProtocolErrors 13
+ 19, # fcStatsBadCRCErrors 11
+ 20, # fcStatsProtocolErrors 12
+ 18, # fcStatsDiscardedFrameErrors 13
]),
"snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.11096.6"),
- "group": "if",
+ "group" : "if",
"default_levels_variable": "if_default_levels",
+ "includes" : [ "if.include" ],
}