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 # .1.3.6.1.4.1.2021.10.1.5.1 691 1 min
28 # .1.3.6.1.4.1.2021.10.1.5.2 855 5 min
29 # .1.3.6.1.4.1.2021.10.1.5.3 895 15 min
30 # .1.3.6.1.4.1.2021.10.1.6.1 1.350000 1 min
31 # .1.3.6.1.4.1.2021.10.1.6.2 1.250000 5 min
32 # .1.3.6.1.4.1.2021.10.1.6.3 1.240000 15 min
34 cpuload_default_levels
= (5.0, 10.0)
37 def inventory_ucd_cpu_load(info
):
39 return [(None, "cpuload_default_levels")]
42 def check_ucd_cpu_load(item
, params
, info
):
43 # Some devices provide only one table. We prefer float table
44 this_cpu_load_table
= []
45 for int_cpu_load_str
, float_cpu_load_str
in info
:
46 if float_cpu_load_str
:
47 this_cpu_load_table
.append(float(float_cpu_load_str
.replace(",", ".")))
48 elif int_cpu_load_str
:
49 this_cpu_load_table
.append(float(int_cpu_load_str
) / 100.0)
51 this_cpu_load_table
.append(0)
53 # Note: Some dump devices send 12,540000 instead of 12.540000
54 return check_cpu_load_generic(params
, this_cpu_load_table
)
57 check_info
["ucd_cpu_load"] = {
58 'inventory_function': inventory_ucd_cpu_load
,
59 'check_function': check_ucd_cpu_load
,
60 'service_description': 'CPU load',
63 '.1.3.6.1.4.1.2021.10.1',
65 "5", # UCD-SNMP-MIB::laLoadInt Int table
66 "6", # UCD-SNMP-MIB::laLoadFloat Float table
68 # 'CPU load' is not available in the HR-MIB
69 # thus we cannot use 'prefer_hr_scan_function'
70 'snmp_scan_function': is_ucd
,
72 "includes": ["cpu_load.include", "ucd_hr.include"],