Disentangled Livestatus Proxy and socket connection settings
[check_mk.git] / checks / netapp_fcpio
blob0b6d55ad0d25a6df15bf0efb3b2a32af2047c8a2
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.
27 netapp_fcpio_default_levels = {"read": (None, None), "write": (None, None)}
30 def check_netapp_fcpio(item, params, info):
31 read, write = map(int, info[0])
32 this_time = int(time.time())
33 avg_read = get_rate("netapp_fcpio.read", this_time, read)
34 avg_write = get_rate("netapp_fcpio.write", this_time, write)
36 read_warn, read_crit = params['read']
37 write_warn, write_crit = params['write']
39 perfdata = [
40 ("write", avg_write, write_warn, write_crit),
41 ("read", avg_read, read_warn, read_crit),
43 state = 0
44 read_msg = ''
45 write_msg = ''
46 if read_warn is not None and read_warn >= read:
47 state = 1
48 read_msg = ' (!)'
49 if read_crit is not None and read_crit >= read:
50 state = 2
51 read_msg = ' (!!)'
53 if write_warn is not None and write_warn >= write:
54 state = max(state, 1)
55 write_msg = ' (!)'
56 if write_crit is not None and write_crit >= write:
57 state = 2
58 write_msg = ' (!!)'
61 infotext = "%s read%s, %s write%s" % (get_bytes_human_readable(avg_read), \
62 read_msg, get_bytes_human_readable(avg_write), write_msg)
64 return (state, infotext, perfdata)
67 check_info["netapp_fcpio"] = {
68 "check_function" : check_netapp_fcpio,
69 "inventory_function" : lambda info: [(None, "netapp_fcpio_default_levels")],
70 "service_description" : "FCP I/O",
71 "has_perfdata" : True,
72 "group" : "netapp_fcportio",
73 "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.1.0").startswith('NetApp Release') \
74 and oid(".1.3.6.1.4.1.789.1.17.20.0"),
75 "snmp_info" : ( ".1.3.6.1.4.1.789.1.17", [ 20, 21 ]),