Module: check_mk
Branch: master
Commit: c7349985ec1b0a75d7b8d0da720453396a3025e5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c7349985ec1b0a…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue May 31 11:37:27 2016 +0200
3629 gude_relayport: new check which monitors the ON/OFF state of a GUDE Power Control
device
---
.werks/3629 | 9 +++++++
ChangeLog | 1 +
checkman/gude_relayport | 14 +++++++++++
checks/gude_relayport | 60 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 84 insertions(+)
diff --git a/.werks/3629 b/.werks/3629
new file mode 100644
index 0000000..61c02e8
--- /dev/null
+++ b/.werks/3629
@@ -0,0 +1,9 @@
+Title: gude_relayport: new check which monitors the ON/OFF state of a GUDE Power Control
device
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1464687418
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index ca62d54..b5ea174 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -93,6 +93,7 @@
NOTE: Please refer to the migration notes!
* 3138 jolokia_metrics.cache_hits, jolokia_metrics.in_memory,
jolokia_metrics.off_heap, jolokia_metrics.on_disk, jolokia_metrics.writer: added checks
for monitoring of ehcache metrics through jolokia...
* 3628 emcvnx_mirrorview: new check which monitors the mirrorviews of EMC VNX storage
system...
+ * 3629 gude_relayport: new check which monitors the ON/OFF state of a GUDE Power
Control device
* 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/gude_relayport b/checkman/gude_relayport
new file mode 100644
index 0000000..ea41f61
--- /dev/null
+++ b/checkman/gude_relayport
@@ -0,0 +1,14 @@
+title: GUDE Power Control: Relay port status
+agents: snmp
+catalog: hw/other
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the ON/OFF state of a GUDE Power
+ Control device which supports the GUDEADS-EPC1100-MIB.
+
+item:
+ The relay port name.
+
+inventory:
+ One service per relay port is created.
diff --git a/checks/gude_relayport b/checks/gude_relayport
new file mode 100644
index 0000000..9a47499
--- /dev/null
+++ b/checks/gude_relayport
@@ -0,0 +1,60 @@
+#!/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.28507.19.1.3.1.2.1.2.1 Power Port 1 -->
GUDEADS-EPC1100-MIB::epc1100PortName.1
+# .1.3.6.1.4.1.28507.19.1.3.1.2.1.3.1 1 --> GUDEADS-EPC1100-MIB::epc1100PortState.1
+
+
+def inventory_gude_relayport(info):
+ for port_name, port_status in info:
+ if port_status != "0":
+ yield port_name, None
+
+
+def check_gude_relayport(item, params, info):
+ map_powerstates = {
+ "0" : (2, "off"),
+ "1" : (0, "on"),
+ }
+
+ for port_name, port_status in info:
+ if item == port_name:
+ state, state_readable = map_powerstates[port_status]
+ infotext = "Status: %s" % state_readable
+ return state, infotext
+
+
+check_info['gude_relayport'] = {
+ 'inventory_function' : inventory_gude_relayport,
+ 'check_function' : check_gude_relayport,
+ 'service_description' : 'Relay port %s',
+ 'snmp_info' : (".1.3.6.1.4.1.28507.19.1.3.1.2.1",
[
+ "2", #
GUDEADS-EPC1100-MIB::epc1100PortName
+ "3", #
GUDEADS-EPC1100-MIB::epc1100PortState
+ ]),
+ 'snmp_scan_function' : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.28507.19"),
+}