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 # Example output from agent:
29 # 1 99.17 0.54 0.18 0.00
32 def parse_vms_cpu(info
):
35 parsed
['num_cpus'] = int(info
[0][0])
36 for i
, key
in enumerate(('idle', 'user', 'wait_interrupt', 'wait_npsync'), 1):
37 parsed
[key
] = float(info
[0][i
]) / parsed
['num_cpus']
38 except (IndexError, ValueError):
44 def inventory_vms_cpu(info
):
49 def check_vms_cpu(_no_item
, params
, parsed
):
51 # and legacy default None prior to 1.6
52 params
= transform_cpu_iowait(params
)
55 wait
= parsed
["wait_interrupt"] + parsed
["wait_npsync"]
56 util
= 100. - parsed
["idle"]
57 system
= util
- user
- wait
60 user
, "user", None, human_readable_func
=get_percent_human_readable
, infoname
="User")
62 system
, "system", None, human_readable_func
=get_percent_human_readable
, infoname
="System")
67 human_readable_func
=get_percent_human_readable
,
70 for util_result
in check_cpu_util(util
, params
):
73 num_cpus
= parsed
['num_cpus']
74 unit
= "CPU" if num_cpus
== 1 else "CPUs"
76 num_cpus
, 'cpu_entitlement', None, unit
=unit
, infoname
="100% corresponding to")
79 check_info
['vms_cpu'] = {
80 "parse_function": parse_vms_cpu
,
81 "check_function": check_vms_cpu
,
82 "inventory_function": inventory_vms_cpu
,
83 "service_description": "CPU utilization",
85 "group": "cpu_iowait",
86 "includes": ["transforms.include", "cpu_util.include"],