Cleanup config.nodes_of
[check_mk.git] / checks / nimble_latency
blob073d085a4d0c0f00cee454981de5107a74572bb1
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 # example output
29 factory_settings["nimble_latency_default_levels"] = {
30 "0.1": (0, 20),
31 "0.2": (0, 20),
32 "0.5": (0, 20),
33 "1": (0, 20),
34 "2": (0, 20),
35 "5": (0, 20),
36 "10": (1, 20),
37 "20": (1, 20),
38 "50": (1, 20),
39 "100": (2, 20),
40 "200": (2, 20),
41 "500": (2, 20),
42 "1000": (2, 20),
46 def inventory_nimble_latency(info):
47 for line in info:
48 if line[1] == "1":
49 yield (line[0], {})
52 def check_nimble_read_latency(item, params, info):
53 timestamp = time.time()
54 for line in info:
55 if line[0] == item:
56 counter_base = "nimble_read_latency.%s." % item
57 names = {
58 "0-0.1 ms": ("0.1", int(line[3])),
59 "0.1-0.2 ms": ("0.2", int(line[4])),
60 "0.2-0.5 ms": ("0.5", int(line[5])),
61 "0.5-1.0 ms": ("1", int(line[6])),
62 "1-2 ms": ("2", int(line[7])),
63 "2-5 ms": ("5", int(line[8])),
64 "5-10 ms": ("10", int(line[9])),
65 "10-20 ms": ("20", int(line[10])),
66 "20-50 ms": ("50", int(line[11])),
67 "50-100 ms": ("100", int(line[12])),
68 "100-200 ms": ("200", int(line[13])),
69 "200-500 ms": ("500", int(line[14])),
70 "500+ ms": ("1000", int(line[15])),
72 total_reads = get_rate(counter_base + "total", timestamp, int(line[2]))
73 yield 0, "Total Reads: %d" % total_reads
74 for key, value in names.iteritems():
75 counter = get_rate(counter_base + value[0], timestamp, value[1])
76 state, state_count = params[value[0]]
77 if counter > state_count:
78 yield state, "%s: %d" % (key, counter)
79 else:
80 continue
83 check_info['nimble_latency'] = {
84 'inventory_function': inventory_nimble_latency,
85 'check_function': check_nimble_read_latency,
86 'service_description': 'Volume %s Read IO',
87 'snmp_info': (
88 '.1.3.6.1.4.1.37447.1.2.1',
90 "3", # NIMBLE-MIB::volName
91 "10", # NIMBLE-MIB::volOnline
92 "13", # NIMBLE-MIB::volIoReads
93 "21", # NIMBLE-MIB::volIoReadLatency0uTo100u
94 "22", # NIMBLE-MIB::volIoReadLatency100uTo200u
95 "23", # NIMBLE-MIB::volIoReadLatency200uTo500u
96 "24", # NIMBLE-MIB::volIoReadLatency500uTo1m
97 "25", # NIMBLE-MIB::volIoReadLatency1mTo2m
98 "26", # NIMBLE-MIB::volIoReadLatency2mTo5m
99 "27", # NIMBLE-MIB::volIoReadLatency5mTo10m
100 "28", # NIMBLE-MIB::volIoReadLatency10mTo20m
101 "29", # NIMBLE-MIB::volIoReadLatency20mTo50m
102 "30", # NIMBLE-MIB::volIoReadLatency50mTo100m
103 "31", # NIMBLE-MIB::volIoReadLatency100mTo200m
104 "32", # NIMBLE-MIB::volIoReadLatency200mTo500m
105 "33", # NIMBLE-MIB::volIoReadLatency500mTomax
106 "39", # NIMBLE-MIB::volIoWriteLatency0uTo100u
107 "40", # NIMBLE-MIB::volIoWriteLatency100uTo200u
108 "41", # NIMBLE-MIB::volIoWriteLatency200uTo500u
109 "42", # NIMBLE-MIB::volIoWriteLatency500uTo1m
110 "43", # NIMBLE-MIB::volIoWriteLatency1mTo2m
111 "44", # NIMBLE-MIB::volIoWriteLatency2mTo5m
112 "45", # NIMBLE-MIB::volIoWriteLatency5mTo10m
113 "46", # NIMBLE-MIB::volIoWriteLatency10mTo20m
114 "47", # NIMBLE-MIB::volIoWriteLatency20mTo50m
115 "48", # NIMBLE-MIB::volIoWriteLatency50mTo100m
116 "49", # NIMBLE-MIB::volIoWriteLatency100mTo200m
117 "50", # NIMBLE-MIB::volIoWriteLatency200mTo500m
118 "51", # NIMBLE-MIB::volIoWriteLatency500mTomax
120 'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.37447.3.1"
122 'group': "nimble_latency",
123 'default_levels_variable': "nimble_latency_default_levels",
127 def check_nimble_write_latency(item, params, info):
128 timestamp = time.time()
129 for line in info:
130 if line[0] == item:
131 counter_base = "nimble_write_latency.%s." % item
132 names = {
133 "0-0.1 ms": ("0.1", int(line[3])),
134 "0.1-0.2 ms": ("0.2", int(line[4])),
135 "0.2-0.5 ms": ("0.5", int(line[5])),
136 "0.5-1.0 ms": ("1", int(line[6])),
137 "1-2 ms": ("2", int(line[7])),
138 "2-5 ms": ("5", int(line[8])),
139 "5-10 ms": ("10", int(line[9])),
140 "10-20 ms": ("20", int(line[10])),
141 "20-50 ms": ("50", int(line[11])),
142 "50-100 ms": ("100", int(line[12])),
143 "100-200 ms": ("200", int(line[13])),
144 "200-500 ms": ("500", int(line[14])),
145 "500+ ms": ("1000", int(line[15])),
147 total_writes = get_rate(counter_base + "total", timestamp, int(line[2]))
148 yield 0, "Total Writes: %d" % total_writes
149 for key, value in names.iteritems():
150 counter = get_rate(counter_base + value[0], timestamp, value[1])
151 state, state_count = params[value[0]]
152 if counter > state_count:
153 yield state, "%s: %d" % (key, counter)
154 else:
155 continue
158 check_info['nimble_latency.write'] = {
159 'inventory_function': inventory_nimble_latency,
160 'check_function': check_nimble_write_latency,
161 'service_description': 'Volume %s Write IO',
162 'group': "nimble_latency",
163 'default_levels_variable': "nimble_latency_default_levels",