Cleanup config.nodes_of
[check_mk.git] / checks / emc_vplex_volumes
blobb68772ad3fb84b034a804a47ecc987e69e1f8844
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 parse_emc_vplex_volumes(info):
29 volumes = {}
30 now = time.time()
32 # Each volume is listed twice, because they are connected to both directors
33 instance_count = {}
34 for line in info:
35 # Note: Since the volume name can appear multiple times we need an instance
36 # counter for each volume. Let's hope they always appear in the same order...
37 name = line[0]
38 instance_count.setdefault(name, 0)
39 instance_count[name] += 1
40 read_delta = get_rate("readbytes.%s.%s" % (name, instance_count[name]), now, int(line[3]))
41 write_delta = get_rate("writebytes.%s.%s" % (name, instance_count[name]), now, int(line[4]))
42 ios = get_rate("ios.%s.%s" % (name, instance_count[name]), now, int(line[2]))
43 read_wait = float(line[5]) / 1000000
44 write_wait = float(line[6]) / 1000000
46 if name in volumes:
47 volumes[name]["read_throughput"] += read_delta
48 volumes[name]["write_throughput"] += write_delta
49 volumes[name]["ios"] += ios
50 volumes[name]["average_read_wait"] = max(volumes[name]["average_read_wait"], read_wait)
51 volumes[name]["average_write_wait"] = max(volumes[name]["average_write_wait"],
52 write_wait)
53 else:
54 volumes[name] = {
55 "average_read_wait": read_wait,
56 "average_write_wait": write_wait,
57 "read_throughput": read_delta,
58 "write_throughput": write_delta,
59 "ios": ios
62 return volumes
65 def inventory_emc_vplex_volumes(parsed):
66 return inventory_diskstat_generic([(None, x) for x in parsed.keys()])
69 def check_emc_vplex_volumes(item, params, parsed):
70 # The check_diskstat_dict function may compute average values
71 # We won't allow this if some of the counters have wrapped
72 if last_counter_wrap():
73 raise MKCounterWrapped("Value overflow")
74 return check_diskstat_dict(item, params, parsed)
76 check_info["emc_vplex_volumes"] = {
77 "parse_function" : parse_emc_vplex_volumes,
78 "check_function" : check_emc_vplex_volumes,
79 "inventory_function" : inventory_emc_vplex_volumes,
80 "service_description" : "Disk IO Volume %s",
81 "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.1.0") == "" and\
82 oid(".1.3.6.1.4.1.1139.21.2.2.8.1.*"),
83 "snmp_info" :
84 (".1.3.6.1.4.1.1139.21.2.2.8.1", [
85 1, # vplexDirectorVirtualVolumeName
86 2, # vplexDirectorVirtualVolumeUuid
87 3, # vplexDirectorVirtualVolumeOps
88 4, # vplexDirectorVirtualVolumeRead
89 5, # vplexDirectorVirtualVolumeWrite
90 6, # vplexDirectorVirtualVolumeReadAvgLatency
91 7, # vplexDirectorVirtualVolumeWriteAvgLatency
92 ]),
93 "has_perfdata" : True,
94 "group" : "diskstat",
95 "includes" : [ "diskstat.include" ],