Module: check_mk
Branch: master
Commit: cfa9b56f90a9ce84e223e20d972fd850f7a2cd4c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cfa9b56f90a9ce…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Dec 8 11:12:06 2015 +0100
#1313 apc_sts_inputs: New Check for APC Static Transfer Swichtes: Input Phases
---
.werks/1313 | 9 +++++
ChangeLog | 1 +
checkman/apc_sts_inputs | 16 +++++++++
checks/apc_sts_inputs | 85 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 111 insertions(+)
diff --git a/.werks/1313 b/.werks/1313
new file mode 100644
index 0000000..3348063
--- /dev/null
+++ b/.werks/1313
@@ -0,0 +1,9 @@
+Title: apc_sts_inputs: New Check for APC Static Transfer Swichtes: Input Phases
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1449569493
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 4214fae..c386a88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -56,6 +56,7 @@
* 2866 ewon: Added support for monitoring Wagner OxyReduct devices with their data
exposed through an ewon router...
* 2867 check_http: client certificate and private key file parameters can now be set
in wato...
* 2884 mssql_blocked_sessions: the state of the blocked sessions is now configurable
+ * 1313 apc_sts_inputs: New Check for APC Static Transfer Swichtes: Input Phases
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/checkman/apc_sts_inputs b/checkman/apc_sts_inputs
new file mode 100644
index 0000000..bc967ad
--- /dev/null
+++ b/checkman/apc_sts_inputs
@@ -0,0 +1,16 @@
+title: APC STS: Input Phases
+agents: snmp
+catalog: hw/power/apc
+license: GPL
+distribution: check_mk
+description:
+ This Check monitors the input measurements of a APC Static Transfer Switch.
+
+item:
+ The identifier of the phase (usually {"Source 1 Phase 1"}, {"Source 1
Phase 2"}, {"Source 1Phase 3"}).
+
+perfdata:
+ Three values: Voltage, current and power.
+
+inventory:
+ Creates six items - one per source and input phase.
diff --git a/checks/apc_sts_inputs b/checks/apc_sts_inputs
new file mode 100644
index 0000000..3754128
--- /dev/null
+++ b/checks/apc_sts_inputs
@@ -0,0 +1,85 @@
+#!/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.
+
+# .1.3.6.1.4.1.705.2.3.2.1.2.1 3997 -->
MG-SNMP-STS-MIB::stsmgSource1PhasePhaseVoltage.1
+# .1.3.6.1.4.1.705.2.3.2.1.2.2 4017 -->
MG-SNMP-STS-MIB::stsmgSource1PhasePhaseVoltage.2
+# .1.3.6.1.4.1.705.2.3.2.1.2.3 4012 -->
MG-SNMP-STS-MIB::stsmgSource1PhasePhaseVoltage.3
+# .1.3.6.1.4.1.705.2.3.2.1.3.1 0 --> MG-SNMP-STS-MIB::stsmgSource1Current.1
+# .1.3.6.1.4.1.705.2.3.2.1.3.2 0 --> MG-SNMP-STS-MIB::stsmgSource1Current.2
+# .1.3.6.1.4.1.705.2.3.2.1.3.3 0 --> MG-SNMP-STS-MIB::stsmgSource1Current.3
+# .1.3.6.1.4.1.705.2.3.2.1.4.1 0 --> MG-SNMP-STS-MIB::stsmgSource1ActivePower.1
+# .1.3.6.1.4.1.705.2.3.2.1.4.2 0 --> MG-SNMP-STS-MIB::stsmgSource1ActivePower.2
+# .1.3.6.1.4.1.705.2.3.2.1.4.3 0 --> MG-SNMP-STS-MIB::stsmgSource1ActivePower.3
+# .1.3.6.1.4.1.705.2.3.16.0 499 --> MG-SNMP-STS-MIB::stsmgSource1Frequency.0
+
+#
+#
+# .1.3.6.1.4.1.705.2.4.2.1.2.1 3946 -->
MG-SNMP-STS-MIB::stsmgSource2PhasePhaseVoltage.1
+# .1.3.6.1.4.1.705.2.4.2.1.2.2 3970 -->
MG-SNMP-STS-MIB::stsmgSource2PhasePhaseVoltage.2
+# .1.3.6.1.4.1.705.2.4.2.1.2.3 3955 -->
MG-SNMP-STS-MIB::stsmgSource2PhasePhaseVoltage.3
+# .1.3.6.1.4.1.705.2.4.2.1.3.1 170 --> MG-SNMP-STS-MIB::stsmgSource2Current.1
+# .1.3.6.1.4.1.705.2.4.2.1.3.2 155 --> MG-SNMP-STS-MIB::stsmgSource2Current.2
+# .1.3.6.1.4.1.705.2.4.2.1.3.3 146 --> MG-SNMP-STS-MIB::stsmgSource2Current.3
+# .1.3.6.1.4.1.705.2.4.2.1.4.1 3700 --> MG-SNMP-STS-MIB::stsmgSource2ActivePower.1
+# .1.3.6.1.4.1.705.2.4.2.1.4.2 3500 --> MG-SNMP-STS-MIB::stsmgSource2ActivePower.2
+# .1.3.6.1.4.1.705.2.4.2.1.4.3 3300 --> MG-SNMP-STS-MIB::stsmgSource2ActivePower.3
+# .1.3.6.1.4.1.705.2.4.16.0 499 --> MG-SNMP-STS-MIB::stsmgSource2Frequency.0
+
+factory_settings['apc_sts_inputs_default_levels'] = {
+}
+
+def parse_apc_sts_inputs(info):
+ parsed = {}
+ phase = 1
+ for voltage, current, power in info:
+ source = int(voltage.split('.')[0]) - 2
+ parsed["Source %d Phase %d" % ( source, phase) ] = {
+ "voltage" : int(voltage.split('.')[1]) / 10.0,
+ "current" : int(current) / 10.0,
+ "power" : int(power),
+ }
+ phase += 1
+ if phase == 4:
+ phase = 1
+ return parsed
+
+check_info["apc_sts_inputs"] = {
+ 'parse_function' : parse_apc_sts_inputs,
+ 'inventory_function' : inventory_elphase,
+ 'check_function' : check_elphase,
+ 'service_description' : 'Input %s',
+ 'default_levels_variable' : 'apc_sts_inputs_default_levels',
+ 'includes' : [ "elphase.include", ],
+ 'group' : 'el_inphase',
+ "has_perfdata" : True,
+ "snmp_scan_function" : lambda oid: ".1.3.6.1.4.1.705.2.2"
in oid(".1.3.6.1.2.1.1.2.0"),
+ "snmp_info" : ( ".1.3.6.1.4.1.705.2", [ 3, 4 ] ,
[
+ "2.1.2",
# Phase Voltage
+ "2.1.3",
# Current
+ "2.1.4",
# Active Power
+ ] ),
+}
+