2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2019 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 # exemplary output of special agent agent_ucs_bladecenter (<TAB> is tabulator):
29 # <<<ucsc_server_temp:sep(9)>>>
30 # processorEnvStats<TAB>dn sys/rack-unit-1/board/cpu-1/env-stats<TAB>id 1<TAB>description blalub<TAB>temperature 58.4
31 # processorEnvStats<TAB>dn sys/rack-unit-1/board/cpu-2/env-stats<TAB>id 2<TAB>description blalub<TAB>temperature 50.4
32 # memoryUnitEnvStats<TAB>dn sys/rack-unit-1/board/memarray-1/mem-1/dimm-env-stats<TAB>id 1<TAB>description blalub<TAB>temperature 40.4
33 # memoryUnitEnvStats<TAB>dn sys/rack-unit-1/board/memarray-1/mem-2/dimm-env-stats<TAB>id 2<TAB>description blalub<TAB>temperature 41.4
34 # computeRackUnitMbTempStats<TAB>dn sys/rack-unit-1/board/temp-stats<TAB>ambientTemp 50.0<TAB>frontTemp 50.0<TAB>ioh1Temp 50.0<TAB>ioh2Temp 50.0<TAB>rearTemp 50.0
35 # computeRackUnitMbTempStats<TAB>dn sys/rack-unit-2/board/temp-stats<TAB>ambientTemp 50.0<TAB>frontTemp 50.0<TAB>ioh1Temp 50.0<TAB>ioh2Temp 50.0<TAB>rearTemp 50.0
38 def parse_ucs_c_rack_server_temp(info
):
40 Returns dict with indexed processors, memory units and motherboards mapped to keys and
45 key_value_pairs
= [kv
.split(" ", 1) for kv
in line
[1:]]
46 if "cpu-" in key_value_pairs
[0][1]:
47 cpu
= key_value_pairs
[0][1].replace("sys/",
48 "").replace("rack-unit-", "Rack Unit ").replace(
49 "/board", "").replace("/cpu-", " CPU ").replace(
52 parsed
[cpu
] = float(key_value_pairs
[3][1])
53 except (ValueError, KeyError):
54 continue # skip potentially invalid agent output
55 elif "mem-" in key_value_pairs
[0][1]:
56 mem
= key_value_pairs
[0][1].replace("sys/", "").replace(
57 "rack-unit-", "Rack Unit ").replace("/board", "").replace(
58 "/memarray-", " Memory Array ").replace("/mem-", " Memory DIMM ").replace(
59 "/dimm-env-stats", "")
61 parsed
[mem
] = float(key_value_pairs
[3][1])
62 except (ValueError, KeyError):
63 continue # skip potentially invalid agent output
64 elif "board" in key_value_pairs
[0][1]:
65 mb
= key_value_pairs
[0][1].replace("sys/",
66 "").replace("rack-unit-", "Rack Unit ").replace(
67 "/board/temp-stats", " Motherboard")
69 parsed
[mb
] = float(key_value_pairs
[2][1])
70 except (ValueError, KeyError):
71 continue # skip potentially invalid agent output
73 continue # skip potentially invalid agent output
78 def check_ucs_c_rack_server_temp(item
, params
, temperature
):
79 yield check_temperature(temperature
, params
,
80 'ucs_c_rack_server_%s' % item
.lower().replace(" ", "_"))
83 check_info
["ucs_c_rack_server_temp"] = {
84 'parse_function': parse_ucs_c_rack_server_temp
,
85 'inventory_function': discover(),
86 'check_function': check_ucs_c_rack_server_temp
,
87 'group': 'temperature',
88 'service_description': 'Temperature %s',
90 'includes': ['temperature.include'],