Module: check_mk
Branch: master
Commit: cd9dfbfd8bbced9448da209dc1117f8e5877e13d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cd9dfbfd8bbced…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Thu Apr 17 14:46:37 2014 +0200
wagner_titanus_topsense.smoke: New check for Smoke Detectors in Wagner Titanus Top Sens
devices
---
.werks/894 | 8 ++++
ChangeLog | 1 +
checkman/wagner_titanus_topsense.smoke | 18 ++++++++
checks/wagner_titanus_topsense | 45 ++++++++++++++++++--
.../check_mk-wagner_titanus_topsense.smoke.php | 34 +++++++++++++++
web/plugins/perfometer/check_mk.py | 6 +++
6 files changed, 109 insertions(+), 3 deletions(-)
diff --git a/.werks/894 b/.werks/894
new file mode 100644
index 0000000..00edc06
--- /dev/null
+++ b/.werks/894
@@ -0,0 +1,8 @@
+Title: wagner_titanus_topsense.smoke: New check for Smoke Detectors in Wagner Titanus Top
Sens devices
+Level: 1
+Component: checks
+Version: 1.2.5i3
+Date: 1397738763
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 83cdd29..b4e41b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,7 @@
* 0808 brocade_mlx*: Checks now also work correctly with Brocade ADX / FGS / ICX
devices
* 0892 wagner_titanus_topsense: new info check and overall status check for Wagner
Titanus Top Sens devices
* 0893 wagner_titanus_topsense.alarm: New check for Alarms Triggered on Wagner
Titanus Top Sens devices
+ * 0894 wagner_titanus_topsense.smoke: New check for Smoke Detectors in Wagner Titanus
Top Sens devices
* 0777 FIX: special agent emcvnx: did not work with security file authentication...
* 0786 FIX: zfsget: fixed compatibility with older Solaris agents...
* 0809 FIX: brocade_fcport: Fixed recently introduced problem with port speed
detection
diff --git a/checkman/wagner_titanus_topsense.smoke
b/checkman/wagner_titanus_topsense.smoke
new file mode 100644
index 0000000..20709bf
--- /dev/null
+++ b/checkman/wagner_titanus_topsense.smoke
@@ -0,0 +1,18 @@
+title: Wagner Titanus Top Sens: Smoke Detectors
+agents: snmp
+catalog: hw/environment/wagner
+license: GPL
+distribution: check_mk
+description:
+ Checks the Levels reported by Smoke Detectors of Wagner Titanus Top Sens devices.
+
+ The check returns {OK} if the level is 0.000000 % and {CRIT} otherwise.
+
+inventory:
+ Creates two checks, one for every Smoke Detector.
+
+item:
+ The ID of the detector.
+
+perfdata:
+ One value: The level of smoke in percent.
diff --git a/checks/wagner_titanus_topsense b/checks/wagner_titanus_topsense
index c084814..7fec122 100644
--- a/checks/wagner_titanus_topsense
+++ b/checks/wagner_titanus_topsense
@@ -41,8 +41,10 @@ wagner_titanus_topsense_info = [(".1.3.6.1.2.1.1",
[1, #
1006]), #
pswFailureDisplayOn 9
# off(0),
on(1)
- (".1.3.6.1.4.1.34187.21501.2.1", [24584008]), #
tsLSNbusOnline 0
- #
offline(0),online(1)
+ (".1.3.6.1.4.1.34187.21501.2.1", [24584008,
# tsLSNbusOnline 0
+ #
offline(0),online(1)
+ 245810000, #
tsBarGraph1String
+ 245820000]), #
tsBarGraph2String
]
def wagner_titanus_topsense_scan(oid):
@@ -146,7 +148,7 @@ def check_wagner_titanus_topsense_alarm(item, _no_params, info):
pre_alarm = info[1][0][7]
info_alarm = info[1][0][8]
else:
- return 3, "%s not found in SNMP" % item
+ return 3, "Alarm Detector %s not found in SNMP" % item
status = 0
message = "No Alarm"
@@ -172,4 +174,41 @@ check_info["wagner_titanus_topsense.alarm"] = {
}
#.
+# .--smoke percent-------------------------------------------------------.
+# | _ _ |
+# | ___ _ __ ___ ___ | | _____ _ __ ___ _ __ ___ ___ _ __ | |_ |
+# | / __| '_ ` _ \ / _ \| |/ / _ \ | '_ \ / _ \ '__/ __/ _ \ '_ \| __|
|
+# | \__ \ | | | | | (_) | < __/ | |_) | __/ | | (_| __/ | | | |_ |
+# | |___/_| |_| |_|\___/|_|\_\___| | .__/ \___|_| \___\___|_| |_|\__| |
+# | |_| |
+# '----------------------------------------------------------------------'
+
+def inventory_wagner_titanus_topsense_smoke(info):
+ return [ ("1", None), ("2", None) ]
+def check_wagner_titanus_topsense_smoke(item, _no_params, info):
+ if item == "1":
+ smoke_perc = float(info[2][0][1])
+ elif item == "2":
+ smoke_perc = float(info[2][0][2])
+ else:
+ return 3, "Smoke Detector %s not found in SNMP" % item
+
+ perfdata = [("smoke_perc", smoke_perc)]
+ if smoke_perc > 0:
+ status = 2
+ else:
+ status = 0
+
+ return status, "%0.6f%% smoke detected" % smoke_perc, perfdata
+
+check_info["wagner_titanus_topsense.smoke"] = {
+ "check_function" : check_wagner_titanus_topsense_smoke,
+ "inventory_function" : inventory_wagner_titanus_topsense_smoke,
+ "service_description" : "Smoke Detector %s",
+ "has_perfdata" : True,
+ "snmp_info" : wagner_titanus_topsense_info,
+ "snmp_scan_function" : wagner_titanus_topsense_scan
+}
+
+#.
diff --git a/pnp-templates/check_mk-wagner_titanus_topsense.smoke.php
b/pnp-templates/check_mk-wagner_titanus_topsense.smoke.php
new file mode 100644
index 0000000..cadd4f1
--- /dev/null
+++ b/pnp-templates/check_mk-wagner_titanus_topsense.smoke.php
@@ -0,0 +1,34 @@
+<?php
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+$opt[1] = "--vertical-label \"%\" -l 0 --title \"$hostname /
$servicedesc\" ";
+
+$def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX ";
+$def[1] .= "AREA:var1#808080:\"Smoke\:\" ";
+$def[1] .= "GPRINT:var1:LAST:\"%0.6lf%%\" ";
+$def[1] .= "LINE1:var1#000080:\"\" ";
+$def[1] .= "GPRINT:var1:MAX:\"(Max\: %0.6lf%%,\" ";
+$def[1] .= "GPRINT:var1:AVERAGE:\"Avg\: %0.6lf%%)\" ";
+?>
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 0738ddb..63d1258 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -931,3 +931,9 @@ def perfometer_licenses_percent(row, check_command, perf_data):
return "%.0f%% used" % used_perc, perfometer_linear( used_perc,
'orange' )
perfometers['check_mk-innovaphone_licenses'] = perfometer_licenses_percent
+
+def perfometer_smoke_percent(row, command, perf):
+ used_perc = float(perf[0][1])
+ return "%0.6f%%" % used_perc, perfometer_linear(used_perc,
"#404040")
+
+perfometers['check_mk-wagner_titanus_topsense.smoke'] = perfometer_smoke_percent