Module: check_mk
Branch: master
Commit: a8e7cc09de730070d4c7382b5250dff2e1c3d8ca
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a8e7cc09de7300…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Feb 23 14:00:30 2016 +0100
#3191 cisco_redundancy: new check which monitors the status of the redundant unit of Cisco
devices supporting the CISCO-RF-MIB
---
.werks/3191 | 9 ++++
ChangeLog | 1 +
checkman/cisco_redundancy | 18 +++++++
checks/cisco_redundancy | 118 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 146 insertions(+)
diff --git a/.werks/3191 b/.werks/3191
new file mode 100644
index 0000000..dc60f8d
--- /dev/null
+++ b/.werks/3191
@@ -0,0 +1,9 @@
+Title: cisco_redundancy: new check which monitors the status of the redundant unit of
Cisco devices supporting the CISCO-RF-MIB
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1456232351
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index ecba0ab..a691518 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,7 @@
* 2996 websphere_mq_queues: now able to configure levels for used percentage of total
queues
* 3190 entity_sensors, entity_sensors.fan: new checks monitoring temperature and fan
sensors of devices such as Palo Alto Networks which support the ENTITY-SENSORS-MIB
* 3081 mk_jolokia: plugin now supports setting custom CAs for verifying server
certificate as well as sending a client certificate...
+ * 3191 cisco_redundancy: new check which monitors the status of the redundant unit of
Cisco devices supporting the CISCO-RF-MIB
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative
to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/checkman/cisco_redundancy b/checkman/cisco_redundancy
new file mode 100644
index 0000000..b4a0596
--- /dev/null
+++ b/checkman/cisco_redundancy
@@ -0,0 +1,18 @@
+title: Cisco Devices: Redundancy Framework Status
+agents: snmp
+catalog: hw/network/cisco
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the the status of the redundant unit of Cisco
+ devices which support the CISCO-RF-MIB.
+
+ At discovery the unit id, unit state, peer id, peer state and duplex mode
+ are saved as parameters. At check period if the parameters are still the same
+ the check is OK. If they have changed the service status will turn into WARN
+ if unit or peer state is 'disabled', 'standby hot' or 'active',
or CRIT otherwise.
+ In these cases the reason for the last switch of activity will be reported.
+ Independently if the peer state is 'not known' the state will be CRIT.
+
+inventory:
+ One service will be created.
diff --git a/checks/cisco_redundancy b/checks/cisco_redundancy
new file mode 100644
index 0000000..d9cccac
--- /dev/null
+++ b/checks/cisco_redundancy
@@ -0,0 +1,118 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2016 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-
+# tails. 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.
+
+
+# .1.3.6.1.4.1.9.9.176.1.1.1.0 0 --> CISCO-RF-MIB::cRFStatusUnitId.0
+# .1.3.6.1.4.1.9.9.176.1.1.2.0 14 --> CISCO-RF-MIB::cRFStatusUnitState.0
+# .1.3.6.1.4.1.9.9.176.1.1.3.0 0 --> CISCO-RF-MIB::cRFStatusPeerUnitId.0
+# .1.3.6.1.4.1.9.9.176.1.1.4.0 2 --> CISCO-RF-MIB::cRFStatusPeerUnitState.0
+# .1.3.6.1.4.1.9.9.176.1.1.6.0 2 --> CISCO-RF-MIB::cRFStatusDuplexMode.0
+# .1.3.6.1.4.1.9.9.176.1.1.8.0 1 --> CISCO-RF-MIB::cRFStatusLastSwactReasonCode.0
+
+
+def inventory_cisco_redundancy(info):
+ return [(None, {"init_states" : info[0][:5]})]
+
+
+def check_cisco_redundancy(_no_item, params, info):
+ map_states = {
+ "unit_state" : {
+ "0" : "not found",
+ "1" : "not known",
+ "2" : "disabled",
+ "3" : "initialization",
+ "4" : "negotiation",
+ "5" : "standby cold",
+ "6" : "standby cold config",
+ "7" : "standby cold file sys",
+ "8" : "standby cold bulk",
+ "9" : "standby hot",
+ "10" : "active fast",
+ "11" : "active drain",
+ "12" : "active pre-config",
+ "13" : "active post-config",
+ "14" : "active",
+ "15" : "active extra load",
+ "16" : "active handback",
+ },
+ "duplex_mode" : {
+ "2" : "False (SUB-Peer not detected)",
+ "1" : "True (SUB-Peer detected)",
+ },
+ "swact_reason" : {
+ "1" : "unsupported",
+ "2" : "none",
+ "3" : "not known",
+ "4" : "user initiated",
+ "5" : "user forced",
+ "6" : "active unit failed",
+ "7" : "active unit removed",
+ },
+ }
+ infotexts = {}
+ for what, states in [("now", info[0][:5]), ("init",
params["init_states"])]:
+ unit_id, unit_state, peer_id, peer_state, duplex_mode = states
+ infotexts[what] = "Unit ID: %s (%s), Peer ID: %s (%s), Duplex mode: %s"
% \
+ (unit_id, map_states["unit_state"][unit_state], \
+ peer_id, map_states["unit_state"][peer_state], \
+ map_states["duplex_mode"][duplex_mode])
+
+ unit_id, unit_state, peer_id, peer_state, duplex_mode, swact_reason = info[0]
+
+ if params["init_states"] == info[0][:5]:
+ state = 0
+ infotext = "%s, Last swact reason code: %s" % \
+ (infotexts["now"],
map_states["swact_reason"][info[0][5]])
+ else:
+ if unit_state in ["2", "9", "14"] or peer_state in
["2", "9", "14"]:
+ state = 1
+ else:
+ state = 2
+
+ infotext = "Switchover - Old status: %s, New status: %s" % \
+ (infotext["init"], infotext["now"])
+
+ if peer_state == "1":
+ state = 2
+
+ return state, infotext
+
+
+check_info['cisco_redundancy'] = {
+ 'inventory_function' : inventory_cisco_redundancy,
+ 'check_function' : check_cisco_redundancy,
+ 'service_description' : 'Redundancy Framework Status',
+ 'snmp_info' : ('.1.3.6.1.4.1.9.9.176.1.1', [
+ 1, # cRFStatusUnitId
+ 2, # cRFStatusUnitState
+ 3, # cRFStatusPeerUnitId
+ 4, # cRFStatusPeerUnitState
+ 6, # cRFStatusDuplexMode
+ 8, # cRFStatusLastSwactReasonCode
+ ]),
+ 'snmp_scan_function' : lambda oid: "cisco" in
oid(".1.3.6.1.2.1.1.1.0").lower() \
+ and oid(".1.3.6.1.4.1.9.9.176.1.1.*"),
+}