2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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.
27 # <<<ucs_bladecenter_faultinst:sep(9)>>>
28 # faultInst Dn sys/chassis-2/bl...ault-F1256 Descr Local disk 2 missing on server 2/3 Severity info
29 # faultInst Dn sys/chassis-2/bl...ault-F1256 Descr Local disk 1 missing on server 2/3 Severity info
30 # faultInst Dn sys/chassis-1/bl...ault-F1256 Descr Local disk 2 missing on server 1/3 Severity info
33 def inventory_ucs_bladecenter_faultinst(parsed
):
37 def check_ucs_bladecenter_faultinst(item
, _no_params
, parsed
):
48 for values
in parsed
.get("faultInst", {}).itervalues():
49 entry_sev
= values
.get("Severity").lower()
50 severities
.setdefault(entry_sev
, [])
51 severities
[entry_sev
].append(values
)
53 if not severities
.items():
54 yield 0, "No fault instances found"
57 for sev
, instances
in severities
.items():
58 sev_state
= severity_map
.get(sev
, 3)
60 # Right now, OK instances are also reported in detail
61 # If required we can increase the state level here, so that only WARN+ messages are shown
64 for instance
in instances
:
65 extra_info
.append("%s" % instance
["Descr"])
66 extra_info
= ": " + ", ".join(extra_info
)
70 yield sev_state
, "%d %s Instances%s" % (len(instances
), sev
.upper(), extra_info
)
73 check_info
["ucs_bladecenter_faultinst"] = {
74 'parse_function': ucs_bladecenter_convert_info
,
75 'inventory_function': inventory_ucs_bladecenter_faultinst
,
76 'check_function': check_ucs_bladecenter_faultinst
,
77 'service_description': 'Fault Instances',
78 'includes': ['ucs_bladecenter.include'],