2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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 factory_settings
['cisco_cpu_multiitem_default_levels'] = {
28 'levels': (80.0, 90.0),
32 def parse_cisco_cpu_multiitem(info
):
35 for idx
, desc
in info
[1]:
36 if desc
.lower().startswith("cpu "):
38 ph_idx_to_desc
[idx
] = desc
40 for idx
, util
in info
[0]:
41 if idx
in ph_idx_to_desc
:
42 name
= ph_idx_to_desc
[idx
]
51 def inventory_cisco_cpu_multiitem(parsed
):
56 def check_cisco_cpu_multiitem(item
, params
, parsed
):
57 warn
, crit
= params
['levels']
59 util
= parsed
[item
]['util']
67 infotext
= "%s%% utilization in the last 5 minutes" % util
69 infotext
+= " (warn/crit at %s%%/%s%%)" % (warn
, crit
)
71 yield state
, infotext
, [("util", util
, warn
, crit
, 0, 100)]
74 yield 3, "No information about the CPU utilization available"
76 check_info
["cisco_cpu_multiitem"] = {
77 'parse_function' : parse_cisco_cpu_multiitem
,
78 'check_function' : check_cisco_cpu_multiitem
,
79 'inventory_function' : inventory_cisco_cpu_multiitem
,
80 "group" : "cpu_utilization_multiitem",
81 "default_levels_variable" : "cisco_cpu_multiitem_default_levels",
82 'service_description' : 'CPU utilization %s',
83 'has_perfdata' : True,
84 'snmp_info' : [('.1.3.6.1.4.1.9.9.109.1.1.1', [
85 '1.2', # cpmCPUTotalPhysicalIndex
86 '1.8', # cpmCPUTotal5minRev
88 ('.1.3.6.1.2.1.47.1.1.1', [
90 '1.7', # entPhysicalName
92 'snmp_scan_function' : lambda oid
: 'cisco' in oid('.1.3.6.1.2.1.1.1.0').lower() and \
93 oid('.1.3.6.1.4.1.9.9.109.1.1.1.*') is None,