Module: check_mk
Branch: master
Commit: 8e3595d41637f7228832cc44f821674df2aca527
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8e3595d41637f7…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Mon Sep 15 16:21:53 2014 +0200
#0658 brocade_info: new check to retrieve informational data about Brocade switches
---
.werks/658 | 9 +++++
ChangeLog | 1 +
checkman/brocade_info | 14 ++++++++
checks/brocade_info | 95 +++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 119 insertions(+)
diff --git a/.werks/658 b/.werks/658
new file mode 100644
index 0000000..0963c9c
--- /dev/null
+++ b/.werks/658
@@ -0,0 +1,9 @@
+Title: brocade_info: new check to retrieve informational data about Brocade switches
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1410790889
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 1f57693..1532aad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,7 @@
* 0657 diskstat: cluster support added for single disk modes
* 1111 vCenter monitoring: greatly improved performance (at least 40 times
faster)...
* 1112 esx_vsphere_hostsystem.mem_usage_cluster: allows to monitor total RAM usage of
all nodes in a cluster...
+ * 0658 brocade_info: new check to retrieve informational data about Brocade switches
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
diff --git a/checkman/brocade_info b/checkman/brocade_info
new file mode 100644
index 0000000..3e5a83f
--- /dev/null
+++ b/checkman/brocade_info
@@ -0,0 +1,14 @@
+title: Retrieve informational SNMP data about Brocade switches
+agents: snmp
+catalog: hw/storagehw/brocade
+license: GPL
+distribution: check_mk
+description:
+ This check retrieves the {model name}, {soft serial number}, {firmware
+ version}, and {WWN} of Brocade switches using SNMP.
+
+ Depending on the firmware version only part of the information may be
+ available.
+
+inventory:
+ One check per host will be created.
diff --git a/checks/brocade_info b/checks/brocade_info
new file mode 100644
index 0000000..f11bd03
--- /dev/null
+++ b/checks/brocade_info
@@ -0,0 +1,95 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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.
+
+
+def inventory_brocade_info(info):
+ data = "".join(brocade_info_try_it(info))
+ if data != "----":
+ return [ ( None, None ) ]
+
+def brocade_info_try_it(info):
+ try:
+ model = info[0][0][0]
+ except:
+ model = "-"
+ try:
+ wwn = info[2][0][0]
+ except:
+ wwn = "-"
+ try:
+ fw = info[1][0][0]
+ except:
+ fw = "-"
+ try:
+ ssn = info[1][0][1]
+ except:
+ ssn = "-"
+
+ return model, ssn, fw, wwn
+
+def brocade_info_parse_wwn(val):
+ if val == "":
+ val = "-"
+ elif val != "-":
+ val = ":".join(val.split(" ")[:8])
+ return val
+
+def check_brocade_info(item, params, info):
+ model, ssn, fw, wwn = brocade_info_try_it(info)
+ data = "".join((model, ssn, fw, wwn))
+ if data != "----":
+ wwn = brocade_info_parse_wwn(wwn)
+ infotext = "Model: %s, SSN: %s, Firmware Version: %s, WWN: %s" % (
model, ssn, fw, wwn )
+ return 0, infotext
+ else:
+ return 3, "no information found"
+
+check_info["brocade_info"] = {
+ 'check_function' : check_brocade_info,
+ 'inventory_function' : inventory_brocade_info,
+ 'service_description' : 'Brocade Info',
+ 'has_perfdata' : False,
+ 'snmp_info' : [
+ ( ".1.3.6.1.2.1.47.1.1.1.1.2",
+ [
+ 1, # entPhysicalDescr.1
+ ],
+ ),
+ ( ".1.3.6.1.4.1.1588.2.1.1.1.1",
+ [
+ 6, # swFirmwareVersion
+ 10, # swSsn
+ ]
+ ),
+ ( ".1.3.6.1.3.94.1.6.1",
+ [
+ 1, # connUnitId
+ ],
+ ),
+ ],
+ 'snmp_scan_function' : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.1588.2.1.1") or \
+
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.24.1.1588.2.1.1"),
+}