Module: check_mk
Branch: master
Commit: 2f40457c2822445b543e9ffc42c8194d5532fb8e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2f40457c282244…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Tue Jul 22 16:42:28 2014 +0200
bintec_brrp_status: New Check for BRRP States on Bintec Routers
---
.werks/1136 | 8 ++++++
ChangeLog | 1 +
checkman/bintec_brrp_status | 16 +++++++++++
checks/bintec_brrp_status | 67 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 92 insertions(+)
diff --git a/.werks/1136 b/.werks/1136
new file mode 100644
index 0000000..deeda0e
--- /dev/null
+++ b/.werks/1136
@@ -0,0 +1,8 @@
+Title: bintec_brrp_status: New Check for BRRP States on Bintec Routers
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1406040116
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 2d735fa..9f75e31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,6 +38,7 @@
* 1133 qlogic_sanbox_fabric_element: New Check for Fabric Elements in QLogic SANbox Fibre Channel Switches
* 1134 bintec_sensors.fan: New Check for Fan Speed of Bintec Routers
* 1135 bintec_sensors.voltage, bintec_sensors.temp: New Checks for Voltage and Temperature Sensors of Bintec Routers
+ * 1136 bintec_brrp_status: New Check for BRRP States on Bintec Routers
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output of if checks...
diff --git a/checkman/bintec_brrp_status b/checkman/bintec_brrp_status
new file mode 100644
index 0000000..88c7448
--- /dev/null
+++ b/checkman/bintec_brrp_status
@@ -0,0 +1,16 @@
+title: Bintec Routers: BRRP Status
+agents: snmp
+catalog: hw/network/bintec
+license: GPL
+distribution: check_mk
+description:
+ Checks the Status of BRRP Connections of Bintec Routers.
+
+ If biboBrrpOperState is master or backup the check returns {OK}.
+ On status initialize it returns {WARN}.
+
+item:
+ The ID of the BRRP connection from SNMP.
+
+inventory:
+ Creates one check for every BRRP connection.
diff --git a/checks/bintec_brrp_status b/checks/bintec_brrp_status
new file mode 100644
index 0000000..abf36fe
--- /dev/null
+++ b/checks/bintec_brrp_status
@@ -0,0 +1,67 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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 bintec_brrp_status_compose_item(brrp_id):
+ return re.sub("\..*", "", brrp_id)
+
+def inventory_bintec_brrp_status(info):
+ inventory = []
+ for brrp_id, brrp_status in info:
+ inventory.append( (bintec_brrp_status_compose_item(brrp_id), None ) )
+ return inventory
+
+def check_bintec_brrp_status(item, _no_params, info):
+ for brrp_id, brrp_status in info:
+ brrp_id = bintec_brrp_status_compose_item(brrp_id)
+ if brrp_id == item:
+ if brrp_status == "1":
+ message = "Status for %s is initialize" % brrp_id
+ status = 1
+ elif brrp_status == "2":
+ message = "Status for %s is backup" % brrp_id
+ status = 0
+ elif brrp_status == "3":
+ message = "Status for %s is master" % brrp_id
+ status = 0
+ else:
+ message = "Status for %s is at unknown value %s" % (brrp_id, brrp_status)
+ status = 3
+
+ return status, message
+
+ return 3, "Status for %s not found" % item
+
+check_info["bintec_brrp_status"] = {
+ "check_function" : check_bintec_brrp_status,
+ "inventory_function" : inventory_bintec_brrp_status,
+ "service_description" : "BRRP Status %s",
+ "has_perfdata" : False,
+ "snmp_info" : ( ".1.3.6.1.4.1.272.4.40.1.1", [
+ OID_END,
+ 4, # biboBrrpOperState
+ ]),
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.272.4")
+}