Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / fjdarye500_ca_ports
blob8785cbb113f94472218cdf8ebff5dc347aca586e
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2017 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 inventory_fujitsu_ca_ports = []
30 def parse_fjdarye500_ca_ports(info):
31 map_modes = {
32 "11": "CA",
33 "12": "RA",
34 "13": "CARA",
35 "20": "Initiator",
38 parsed = {}
39 for index, mode, read_iops, write_iops, read_mb, write_mb in info:
40 mode_readable = map_modes[mode]
41 port = parsed.setdefault(
42 index, {
43 "mode": mode_readable,
44 "read_ios": int(read_iops),
45 "read_throughput": int(read_mb) * 1024**2,
47 if mode_readable != "Initiator":
48 port.update({
49 "write_ios": int(write_iops),
50 "write_throughput": int(write_mb) * 1024**2,
52 return parsed
55 def inventory_fjdarye500_ca_ports(parsed):
56 settings = host_extra_conf_merged(host_name(), inventory_fujitsu_ca_ports)
57 indices = settings.get('indices')
58 modes = settings.get('modes', ['CA', 'CARA'])
59 for index, attrs in parsed.iteritems():
60 if indices and index not in indices:
61 continue
62 if modes and attrs['mode'] not in modes:
63 continue
64 yield index, {}
67 def check_fjdarye500_ca_ports(item, params, parsed):
68 if item in parsed:
69 mode = parsed[item]["mode"]
70 yield 0, "Mode: %s" % mode
71 for state, infotext, perfdata in check_diskstat_dict(item, params, parsed):
72 if infotext and "Read: " in infotext and mode in ["CARA", "Initiator"]:
73 infotext.replace("Read: ", "Initiator: ")
74 if infotext and "Write: " in infotext and mode == "CARA":
75 infotext.replace("Write: ", "Target: ")
76 yield state, infotext, perfdata
79 check_info['fjdarye500_ca_ports'] = {
80 'parse_function': parse_fjdarye500_ca_ports,
81 'inventory_function': inventory_fjdarye500_ca_ports,
82 'check_function': check_fjdarye500_ca_ports,
83 'service_description': 'CA Port IO %s',
84 'snmp_info': (
85 '.1.3.6.1.4.1.211.1.21.1.150.5.5.2.1',
87 # fjdaryPfCaPortRdIOPS
88 # "This shows the READ IOPS for the CA,CARA mode.
89 # The Initiator IOPS is shown for RA,Initiator mode."
90 # fjdaryPfCaPortWtIOPS
91 # "This shows the WRITE IOPS for the CA,CARA mode.
92 # The Target IOPS is shown for the RA mode.
93 # This information is an invalid value for the Initiator mode."
94 # fjdaryPfCaPortRdTp
95 # "This shows the amount of the READ Throughput for the CA,CARA mode.
96 # The Initiator Throughput is shown for RA,Initiator mode.
97 # The unit is MB/sec."
98 # fjdaryPfCaPortWtTp
99 # "This shows the amount of the WRITE Throughput for the CA,CARA mode.
100 # The Target Throughput is shown for the RA mode.
101 # The unit is MB/sec.
102 # This information is an invalid value for the Initiator mode."
103 '1', # FJDARY-E150::fjdaryPfCaPortIndex
104 '2', # FJDARY-E150::fjdaryPfCaPortMode
105 '3', # FJDARY-E150::fjdaryPfCaPortRdIOPS
106 '4', # FJDARY-E150::fjdaryPfCaPortWtIOPS
107 '5', # FJDARY-E150::fjdaryPfCaPortRdTp
108 '6', # FJDARY-E150::fjdaryPfCaPortWtTp
110 'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.211.1.21.1.150",
111 'has_perfdata': True,
112 'group': 'diskstat',
113 'includes': ['diskstat.include']