ucs_bladecenter_topsystem, ucs_bladecenter_faulinst
Message-ID: <55a7a34e.doPuESTd3/BwYcF6%ab(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 2e4e09b268677f67eb0325763d9a531d42d518e5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2e4e09b268677f…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Jul 16 14:25:01 2015 +0200
#2405 New checks for UCS bladecenter: ucs_bladecenter_topsystem,
ucs_bladecenter_faulinst
The special agent agent_ucs_bladecenter now queries the additional classes
<i>faulInst</i>
and <i>topSystem</i>. There are two new checks:
<i>ucs_bladecenter_faultinst</i>: This check lists the current fault instances
and goes
WARN or CRIT in case of a severe fault.
<i>ucs_bladecenter_topsystem</i>: This check is just information and always
OK.
It shows the IP-Address, current time, Ipv6-Address, bladecenter mode, system name and
system uptime.
---
.werks/2405 | 16 +++++++
ChangeLog | 1 +
agents/special/agent_ucs_bladecenter | 7 ++++
checkman/ucs_bladecenter_faultinst | 9 ++++
checkman/ucs_bladecenter_topsystem | 9 ++++
checks/ucs_bladecenter_faultinst | 76 ++++++++++++++++++++++++++++++++++
checks/ucs_bladecenter_topsystem | 47 +++++++++++++++++++++
7 files changed, 165 insertions(+)
diff --git a/.werks/2405 b/.werks/2405
new file mode 100644
index 0000000..c119f4a
--- /dev/null
+++ b/.werks/2405
@@ -0,0 +1,16 @@
+Title: New checks for UCS bladecenter: ucs_bladecenter_topsystem,
ucs_bladecenter_faulinst
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1437049272
+Class: feature
+
+The special agent agent_ucs_bladecenter now queries the additional classes
<i>faulInst</i>
+and <i>topSystem</i>. There are two new checks:
+
+<i>ucs_bladecenter_faultinst</i>: This check lists the current fault
instances and goes
+WARN or CRIT in case of a severe fault.
+
+<i>ucs_bladecenter_topsystem</i>: This check is just information and always
OK.
+It shows the IP-Address, current time, Ipv6-Address, bladecenter mode, system name and
system uptime.
diff --git a/ChangeLog b/ChangeLog
index 1edd074..01d16a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@
* 1272 alcatel_power, alcatel_temp Support for stacked environments...
NOTE: Please refer to the migration notes!
* 1273 bvip_cams, bvip_fans, bvip_info, bvip_link, bvip_poe, bvip_temp, bvip_util,
bvip_video_alerts: New Checks for Bosch Video over IP Cameras
+ * 2405 New checks for UCS bladecenter: ucs_bladecenter_topsystem,
ucs_bladecenter_faultinst...
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/agents/special/agent_ucs_bladecenter b/agents/special/agent_ucs_bladecenter
index 0a869ee..d699bd4 100755
--- a/agents/special/agent_ucs_bladecenter
+++ b/agents/special/agent_ucs_bladecenter
@@ -199,6 +199,13 @@ for entry, fields in [
("fabricDceSwSrvPc", ["Dn", "AdminState",
"OperState", "OperSpeed", "Name",
"PortId"]),
("fabricDceSwSrvPcEp", ["Dn", "EpDn",
"AdminState", "OperState", "PortId",
"SwitchId", "SlotId"]),
+ # Fault Instances
+ ("<<<ucs_bladecenter_faultinst:sep(9)>>>", None),
+ ("faultInst", ["Dn", "Descr",
"Severity"]),
+
+ # TopSystem Info
+ ("<<<ucs_bladecenter_topsystem:sep(9)>>>", None),
+ ("topSystem", ["Address", "CurrentTime",
"Ipv6Addr", "Mode", "Name", "SystemUpTime"]),
]:
try:
if fields == None:
diff --git a/checkman/ucs_bladecenter_faultinst b/checkman/ucs_bladecenter_faultinst
new file mode 100644
index 0000000..39cbe09
--- /dev/null
+++ b/checkman/ucs_bladecenter_faultinst
@@ -0,0 +1,9 @@
+title: UCS Bladecenter: Fault Instances
+agents: agent_ucs_bladecenter
+catalog: hw/server/cisco
+license: GPL
+distribution: check_mk
+description:
+ This check shows fault instances for an UCS bladecenter.
+ Depending on the criticality of the fault, the check might go WARN or CRIT.
+
diff --git a/checkman/ucs_bladecenter_topsystem b/checkman/ucs_bladecenter_topsystem
new file mode 100644
index 0000000..ecaeba8
--- /dev/null
+++ b/checkman/ucs_bladecenter_topsystem
@@ -0,0 +1,9 @@
+title: UCS Bladecenter: TopSystem Info
+agents: agent_ucs_bladecenter
+catalog: hw/server/cisco
+license: GPL
+distribution: check_mk
+description:
+ This check displays the information of the TopSystem class of an UCS bladecenter.
+ This includes the IP-Address, Current Time, IPv6-Address, Bladecenter Mode, System Name
and the System Uptime.
+ It is always OK.
diff --git a/checks/ucs_bladecenter_faultinst b/checks/ucs_bladecenter_faultinst
new file mode 100644
index 0000000..a5ca4db
--- /dev/null
+++ b/checks/ucs_bladecenter_faultinst
@@ -0,0 +1,76 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2015 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+
+# <<<ucs_bladecenter_faultinst:sep(9)>>>
+# faultInst Dn sys/chassis-2/bl...ault-F1256 Descr Local disk 2 missing on server 2/3
Severity info
+# faultInst Dn sys/chassis-2/bl...ault-F1256 Descr Local disk 1 missing on server 2/3
Severity info
+# faultInst Dn sys/chassis-1/bl...ault-F1256 Descr Local disk 2 missing on server 1/3
Severity info
+
+def inventory_ucs_bladecenter_faultinst(parsed):
+ yield None, None
+
+def check_ucs_bladecenter_faultinst(item, _no_params, parsed):
+ severity_map = {
+ "critical" : 2,
+ "major" : 1,
+ "warning" : 1,
+ "minor" : 1,
+ "info" : 0,
+ "condition" : 0,
+ "cleared" : 0,
+ }
+ severities = {}
+ for key, values in parsed.get("faultInst", {}).items():
+ entry_sev = values.get("Severity").lower()
+ severities.setdefault(entry_sev, [])
+ severities[entry_sev].append(values)
+
+ state = 0
+ for sev, instances in severities.items():
+ sev_state = severity_map.get(sev, 3)
+ state = max(state, sev_state)
+
+ # Right now, OK instances are also reported in detail
+ # If required we can increase the state level here, so that only WARN+ messages
are shown
+ if sev_state >= 0:
+ extra_info = []
+ for instance in instances:
+ extra_info.append("%s" % instance["Descr"])
+ extra_info = ": " + ", ".join(extra_info)
+ else:
+ extra_info = ""
+
+ yield sev_state, "%d %s Instances%s" % (len(instances), sev.upper(),
extra_info)
+
+check_info["ucs_bladecenter_faultinst"] = {
+ 'parse_function': ucs_bladecenter_convert_info,
+ 'inventory_function': inventory_ucs_bladecenter_faultinst,
+ 'check_function': check_ucs_bladecenter_faultinst,
+ 'service_description': 'Fault Instances',
+ 'includes': [ 'ucs_bladecenter.include' ],
+}
+
diff --git a/checks/ucs_bladecenter_topsystem b/checks/ucs_bladecenter_topsystem
new file mode 100644
index 0000000..fc9102b
--- /dev/null
+++ b/checks/ucs_bladecenter_topsystem
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2015 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+
+# <<<ucs_bladecenter_topsystem:sep(9)>>>
+# topSystem Address 172.20.33.175 CurrentTime 2015-07-15T16:40:27.600 Ipv6Addr ::
Mode cluster Name svie23ucsfi01 SystemUpTime 125:16:10:53
+
+def inventory_ucs_bladecenter_topsystem(info):
+ yield None, None
+
+def check_ucs_bladecenter_topsystem(item, _no_params, info):
+ for entry in info[0][1:]:
+ tokens = entry.split(" ", 1)
+ print tokens
+ if len(tokens) == 2:
+ yield 0, "%s: %s" % tuple(tokens)
+
+check_info["ucs_bladecenter_topsystem"] = {
+ 'inventory_function': inventory_ucs_bladecenter_topsystem,
+ 'check_function': check_ucs_bladecenter_topsystem,
+ 'service_description': 'UCS TopSystem Info',
+ 'includes': [ 'ucs_bladecenter.include' ],
+}
+