Cleanup config.nodes_of
[check_mk.git] / checks / emc_isilon_cpu
blob53a14b5a54ad3bd44c2d9998536e6b838d04cc39
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2015 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 inventory_emc_isilon_cpu_utilization(info):
29 # the device reports cpu utilization for each core and a total. This interprets only the total
30 return [(None, None)]
33 def check_emc_isilon_cpu_utilization(item, params, info):
34 def range_index(value, *dividers):
35 idx = 0
36 for div in dividers:
37 if value < div:
38 break
39 else:
40 idx += 1
41 return idx
43 # expecting only one line because why would there be multiple totals?
44 for line in info:
45 # all utilizations are in per mil
46 # grouping user+nice and system+interrupt, the same way cpu_util.include does
47 user_perc = (int(line[0]) + int(line[1])) * 0.1
48 system_perc = int(line[2]) * 0.1
49 interrupt_perc = int(line[3]) * 0.1
50 total_perc = (user_perc + system_perc + interrupt_perc)
52 infotext = [
53 "user: %.1f%%" % user_perc,
54 ", system: %.1f%%" % system_perc,
55 ", total: %.1f%%" % total_perc
58 status = 0
59 if params:
60 warn, crit = params
61 status = range_index(total_perc, warn, crit)
63 if status != 0:
64 infotext.append(" (warn/crit at %.1f%%/%.1f%%)" % (warn, crit))
66 # perfometer expects a wait value but we don't have data for that
67 perfdata = [("user", "%.3f" % user_perc), ("system", "%.3f" % system_perc),
68 ("interrupt", "%.3f" % interrupt_perc)]
70 return status, "".join(infotext), perfdata
73 check_info["emc_isilon_cpu"] = {
74 "check_function": check_emc_isilon_cpu_utilization,
75 "inventory_function": inventory_emc_isilon_cpu_utilization,
76 "service_description": "Node CPU utilization",
77 "has_perfdata": True,
78 "snmp_info": (
79 ".1.3.6.1.4.1.12124.2.2.3",
81 1, #nodeCPUUser
82 2, #nodeCPUNice
83 3, #nodeCPUSystem
84 4, #nodeCPUInterrupt
85 ]),
86 "snmp_scan_function": lambda oid: "isilon" in oid(".1.3.6.1.2.1.1.1.0").lower(),
87 "group": "cpu_utilization",