Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / hitachi_hnas_fc_if
blob7aeb259e8314d7fe932898eaa96e55a6e6c0f7c6
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
28 def hitachi_hnas_fc_if_convert_info(info):
29 converted = []
30 for line in info:
31 converted.append(
32 map(
33 str,
35 "%d%03d" % (int(line[0]), int(line[1])), # ifIndex
36 line[0] + "." + line[1], # ifDescr (use ClusterNode.InterfaceIndex)
37 "", # ifType: do not set port type
38 int(line[3]) * 1000000000, # ifHighSpeed
39 line[2] == "1" and 1 or 2, # ifOperStatus (map other states to down)
40 line[4], # ifHCInOctets
41 0, # ifHCInUcastPkts
42 0, # ifHCInMulticastPkts
43 0, # ifHCInBroadcastPkts
44 line[13], # ifInDiscards
45 sum(map(int, line[6:13])), # ifInErrors
46 line[5], # ifHCOutOctets
47 0, # ifHCOutUcastPkts
48 0, # ifHCOutMulticastPkts
49 0, # ifHCOutBroadcastPkts
50 0, # ifOutDiscards
51 0, # ifOutErrors
52 0, # ifOutQLen
53 line[0] + "." + line[1], # ifAlias, same as description
54 "", # ifPhysAddress
55 ]))
56 return converted
59 def inventory_hitachi_hnas_fc_if(info):
60 converted = hitachi_hnas_fc_if_convert_info(info)
61 return inventory_if_common(converted)
64 def check_hitachi_hnas_fc_if(item, params, info):
65 converted = hitachi_hnas_fc_if_convert_info(info)
66 return check_if_common(item, params, converted)
69 check_info["hitachi_hnas_fc_if"] = {
70 "check_function": check_hitachi_hnas_fc_if,
71 "inventory_function": inventory_hitachi_hnas_fc_if,
72 "service_description": "Interface FC %s",
73 "has_perfdata": True,
74 "snmp_info": (
75 ".1.3.6.1.4.1.11096.6.1.1.1.3.6.25.1",
77 1, # fcStatsClusterNode 0
78 2, # fcStatsInterfaceIndex 1
79 4, # fcStatsInterfaceStatus 2
80 5, # fcStatsInterfaceLinkSpeed 3
81 7, # fcStatsInstantaneousInRate 4
82 8, # fcStatsInstantaneousOutRate 5
83 13, # fcStatsSignalLossErrors 6
84 14, # fcStatsBadRXCharErrors 7
85 15, # fcStatsLossSyncErrors 8
86 16, # fcStatsLinkFailErrors 9
87 17, # fcStatsRXEOFErrors 10
88 19, # fcStatsBadCRCErrors 11
89 20, # fcStatsProtocolErrors 12
90 18, # fcStatsDiscardedFrameErrors 13
91 ]),
92 "snmp_scan_function": hitachin_hnas_scan_function,
93 "group": "if",
94 "default_levels_variable": "if_default_levels",
95 "includes": ["hitachi_hnas.include", "if.include"],