Module: check_mk
Branch: master
Commit: c427b6c9d97f89a4aadef129186af33eb80dcd98
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c427b6c9d97f89…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu May 21 13:29:13 2015 +0200
#1247 alcatel_timetra_chassis: New Check for Slots, Power Supplies, MDAs, cf cards and
Fans of Alcatel Switches Supporting the TIMETRA-CHASSIS-MIB
---
.werks/1247 | 9 ++++
ChangeLog | 1 +
checkman/alcatel_timetra_chassis | 20 +++++++
checks/alcatel_timetra_chassis | 106 ++++++++++++++++++++++++++++++++++++++
4 files changed, 136 insertions(+)
diff --git a/.werks/1247 b/.werks/1247
new file mode 100644
index 0000000..d505927
--- /dev/null
+++ b/.werks/1247
@@ -0,0 +1,9 @@
+Title: alcatel_timetra_chassis: New Check for Slots, Power Supplies, MDAs, cf cards and
Fans of Alcatel Switches Supporting the TIMETRA-CHASSIS-MIB
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1432207625
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 55cfb0a..c66bdfe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -189,6 +189,7 @@
* 2293 logwatch: Remove global setting logwatch_service_output from WATO...
* 2294 if, if64: Move global option for padding port numbers with zeroes into
rule...
* 2296 win_dhcp_pools: Convert global option for discovery empty pools into rule
set...
+ * 1247 alcatel_timetra_chassis: New Check for Slots, Power Supplies, MDAs, cf cards
and Fans of Alcatel Switches Supporting the TIMETRA-CHASSIS-MIB
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checkman/alcatel_timetra_chassis b/checkman/alcatel_timetra_chassis
new file mode 100644
index 0000000..e577701
--- /dev/null
+++ b/checkman/alcatel_timetra_chassis
@@ -0,0 +1,20 @@
+title: Alcatel switches: Chassis components
+agents: snmp
+catalog: hw/network/alcatel
+license: GPL
+distribution: check_mk
+description:
+ This Checks Monitors the oper, alarm and admin states in Alcatel switchtes supporting
the
+ TIMETRA-CHASSIS-MIB. It rasises {CRIT} if the component enters an Alarm state.
+ There is also {CRIT} if the Operstate changes to "failed" or "out of
serrvices", or the Adminstate
+ changes to "diagnose" or "operate switch".
+ There is a {WARN} in case of "booting", "diagnosing"
"upgrade", "downgrade".
+
+ No Configuration is needed.
+
+item:
+ The name of the device.
+
+inventory:
+ One check is created for each device.
+
diff --git a/checks/alcatel_timetra_chassis b/checks/alcatel_timetra_chassis
new file mode 100644
index 0000000..825b883
--- /dev/null
+++ b/checks/alcatel_timetra_chassis
@@ -0,0 +1,106 @@
+#!/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 inventory_alcatel_timetra_chassis(info):
+ for name, adminstate, operstate, alarmstate in info:
+ # Only add active devices
+ if operstate in [ '2','8' ]:
+ yield name, None
+
+def check_alcatel_timetra_chassis(item, _no_params, info):
+ admin_states = {
+ 1 : "noop",
+ 2 : "inService",
+ 3 : "outOfService",
+ 4 : "diagnose",
+ 5 : "operateSwitch",
+ }
+
+ oper_states = {
+ 1 : "unknown",
+ 2 : "inService",
+ 3 : "outOfService",
+ 4 : "diagnosing",
+ 5 : "failed",
+ 6 : "booting",
+ 7 : "empty",
+ 8 : "provisioned",
+ 9 : "unprovisioned",
+ 10 : "upgrade",
+ 11 : "downgrade",
+ 12 : "inServiceUpgrade",
+ 13 : "inServiceDowngrade",
+ 14 : "resetPending",
+ }
+
+ alarm_states = {
+ 0 : "unknown",
+ 1 : "alarmActive",
+ 2 : "alarmCleared",
+
+ }
+ for line in info:
+ if line[0] == item:
+ adminstate, operstate, alarmstate = map(int, line[1:])
+ state = 0
+ if operstate != adminstate:
+ if adminstate in [4, 5]:
+ state = 2
+ elif adminstate in [3, 1]:
+ state = 1
+ yield state, "Admin State: %s" % admin_states[adminstate]
+
+ state = 0
+ if operstate in [5, 3]:
+ state = 2
+ elif operstate in [4, 6, 10, 11, 12, 13, 14]:
+ state = 1
+ elif operstate not in [2, 8]:
+ state = 3
+ yield state, "Oper State: %s" % oper_states[operstate]
+
+ if alarmstate not in [0,2]:
+ state = 0
+ if alarmstate == 1:
+ state = 2
+ yield state, "Alarms State: %s" % alarm_states[alarmstate]
+ return
+
+
+check_info["alcatel_timetra_chassis"] = {
+ "check_function" : check_alcatel_timetra_chassis,
+ "inventory_function" : inventory_alcatel_timetra_chassis,
+ "service_description" : "Device %s",
+ "has_perfdata" : False,
+ "snmp_scan_function" : lambda oid: "TiMOS" in
oid(".1.3.6.1.2.1.1.1.0"),
+ "snmp_info" : (".1.3.6.1.4.1.6527.3.1.2.2.1.8.1", [
+ 8, # tmnxHwName
+ 15, # tmnxHwAdminState
+ 16, # tmnxHwOperState
+ 24, # tmnxHwAlarmState
+ ]),
+}
+