Module: check_mk
Branch: master
Commit: f6bef77bb2389a1f4f058179cf3eeff863f1504e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f6bef77bb2389a…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Nov 7 13:02:09 2013 +0100
Missing git add cause of werk...
---
checkman/apc_ats | 14 +++++++
checks/apc_ats_status | 99 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 113 insertions(+)
diff --git a/checkman/apc_ats b/checkman/apc_ats
new file mode 100644
index 0000000..0f640af
--- /dev/null
+++ b/checkman/apc_ats
@@ -0,0 +1,14 @@
+title: APC ATS ( Automatic Transfer Swichtes )
+agents: snmp
+catalog: hw/power
+license: GPL
+distribution: check_mk
+description:
+ Checks the status of APC Automatic Transfer Switch.
+ This means it throws {CRIT} if:
+ The power source has changed since last inventory,
+ the communication status gets lost,
+ the redundancy is lost,
+ the current ouput power exceeded the maximum limit for swiching to the alternate power
source
+ or the 5V or 24V supply fails
+
diff --git a/checks/apc_ats_status b/checks/apc_ats_status
new file mode 100644
index 0000000..7681472
--- /dev/null
+++ b/checks/apc_ats_status
@@ -0,0 +1,99 @@
+#!/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_apc_ats_status(info):
+ if len(info) == 1:
+ return [ (None, saveint(info[0][1]) ) ]
+ return []
+
+def check_apc_ats_status(_no_item, source, info):
+ comstatus, selected_source, redundancy, overcurrent, ps5, ps24 = map(saveint,
info[0])
+ state = 0
+ messages = []
+
+ #current source of power
+ sources = { 1 : "A", 2 : "B" }
+ if source != selected_source:
+ state = 2
+ messages.append("Power source Changed from %s to %s(!!)" % \
+ (source[source], sources[selected_source]))
+ else:
+ messages.append("Power source %s selected" % sources[source])
+
+ #current communication status of the Automatic Transfer Switch.
+ if comstatus == 1:
+ state = max(1,state)
+ messages.append("Communication Status: never Discovered(!)")
+ elif comstatus == 3:
+ state = 2
+ messages.append("Communication Status: lost(!!)")
+
+ # current redundancy state of the ATS.
+ # Lost(1) indicates that the ATS is unable to switch over to the alternate power
source
+ # if the current source fails. Redundant(2) indicates that the ATS will switch
+ # over to the alternate power source if the current source fails.
+ if redundancy != 2:
+ state = 2
+ messages.append("redundancy lost(!!)")
+ else:
+ messages.append("Device fully redundant")
+
+ # current state of the ATS. atsOverCurrent(1) indicates that the ATS has i
+ # exceeded the output current threshold and will not allow a switch
+ # over to the alternate power source if the current source fails.
+ # atsCurrentOK(2) indicates that the output current is below the output current
threshold.
+ if overcurrent == 1:
+ state = 2
+ messages.append("exceedet ouput current threshold(!!)")
+
+ # 5Volt power supply
+ if ps5 != 2:
+ state = 2
+ messages.append("5V power supply failed(!!)")
+
+ # 24Volt power supply
+ if ps24 != 2:
+ state = 2
+ messages.append("24V power suppy failed(!!)")
+
+ return state, ", ".join(messages)
+
+check_info["apc_ats_status"] = {
+ "check_function" : check_apc_ats_status,
+ "inventory_function" : inventory_apc_ats_status,
+ "service_description" : "apc_ats_status",
+ "has_perfdata" : False,
+ "snmp_scan_function" : lambda oid: ".1.3.6.1.4.1.318.1.3.11"
in oid(".1.3.6.1.2.1.1.2.0"),
+ "snmp_info" : ( ".1.3.6.1.4.1.318.1.1.8.5.1", [
+ "1.0", #
atsStatusCommStatus
+ "2.0", #
atsStatusSelectedSource
+ "3.0", #
atsStatusRedundancyState
+ "4.0", #
atsStatusOverCurrentState
+ "5.0", #
atsStatus5VPowerSupply
+ "6.0", #
atsStatus24VPowerSupply
+ ] ),
+}
+