2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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.
27 # Example output from agent:
29 # Information about each SPPORT:
33 # SP UID: 50:06:01:60:BE:A0:5D:E5:50:06:01:60:3E:A0:5D:E5
37 # Switch UID: 10:00:00:27:F8:28:52:5B:20:02:00:27:F8:28:52:5B
41 # Auto Negotiable : NO
47 # Requested Value: Auto
48 # MAC Address: Not Applicable
52 # Blocks Read: 4917783
53 # Blocks Written: 12008476
55 # I/O Module Slot: Onboard
58 # SFP/Connector EMC Part Number: 019-078-042
59 # SFP/Connector EMC Serial Number: 00000000000
60 # SFP/Connector Vendor Part Number: AFBR-57D7APZ-E2
61 # SFP/Connector Vendor Serial Number: AGL1213A3188822
62 # SFP/Connector Supported Speeds:
69 # SP UID: 50:06:01:60:BE:A0:5D:E5:50:06:01:61:3E:A0:5D:E5
75 # Parse agent output into a dict of the form:
77 # {'SP A Port 0': {'Blocks Read': 4917783, 'Blocks Written': 12008476},
78 # 'SP A Port 1': {'Blocks Read': 363283639, 'Blocks Written': 218463965},
79 # 'SP A Port 2': {'Blocks Read': 2, 'Blocks Written': 0},
80 # 'SP B Port 0': {'Blocks Read': 0, 'Blocks Written': 4348086},
84 def parse_emcvnx_hba(info
):
87 if len(line
) > 2 and line
[0] == "SP" and line
[1] == "Name:":
88 hba_id
= " ".join(line
[2:])
89 elif len(line
) > 2 and line
[0] == "SP" and line
[1] == "Port" and line
[2] == "ID:":
90 hba_id
+= " Port " + line
[-1]
93 elif len(line
) > 2 and line
[0] == "Blocks" and line
[1] in ("Read:", "Written:"):
94 hba
["Blocks " + line
[1].replace(":", "")] = saveint(line
[-1])
98 def inventory_emcvnx_hba(parsed
):
99 for hba
, values
in parsed
.items():
100 # Old Versions of EMC don't have any Information
105 def check_emcvnx_hba(item
, _no_params
, parsed
):
108 if item
not in parsed
:
109 return 3, "HBA %s not found in agent output" % item
111 read_blocks
= parsed
[item
]["Blocks Read"]
112 write_blocks
= parsed
[item
]["Blocks Written"]
113 countername_r
= "emcvnx_hba.read_blocks.%s" % item
.replace(" ", "_")
114 countername_w
= "emcvnx_hba.write_blocks.%s" % item
.replace(" ", "_")
116 read_blocks_per_sec
= get_rate(countername_r
, now
, read_blocks
)
117 write_blocks_per_sec
= get_rate(countername_w
, now
, write_blocks
)
118 read_blocks_per_sec
= saveint(read_blocks_per_sec
)
119 write_blocks_per_sec
= saveint(write_blocks_per_sec
)
120 perfdata
.append(("read_blocks", read_blocks_per_sec
))
121 perfdata
.append(("write_blocks", write_blocks_per_sec
))
123 return 0, "Read: %s Blocks/s, Write: %s Blocks/s" % (read_blocks_per_sec
,
124 write_blocks_per_sec
), perfdata
127 check_info
['emcvnx_hba'] = {
128 "parse_function": parse_emcvnx_hba
,
129 "inventory_function": inventory_emcvnx_hba
,
130 "check_function": check_emcvnx_hba
,
131 "service_description": "HBA %s",
132 'has_perfdata': True,