Module: check_mk
Branch: master
Commit: 8eab2131a78862424f7781baaddef59955b011cd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8eab2131a78862…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Wed Jan 21 15:39:12 2015 +0100
#1526 climaveneta_fan: No longer outputs performance data, now configured via
"fan" rule
This check is now configured via a different WATO rule, so any old rules set will
no longer apply. Re-inventory required.
---
.werks/1526 | 10 +++++++++
ChangeLog | 2 ++
checkman/climaveneta_fan | 8 +++----
checks/climaveneta_fan | 23 +++++---------------
checks/fan.include | 38 ++++++++++++++++++++++++++++++++++
checks/temperature.include | 3 +--
web/plugins/wato/check_parameters.py | 24 +++++++++++++++++++++
7 files changed, 83 insertions(+), 25 deletions(-)
diff --git a/.werks/1526 b/.werks/1526
new file mode 100644
index 0000000..24e01c2
--- /dev/null
+++ b/.werks/1526
@@ -0,0 +1,10 @@
+Title: climaveneta_fan: No longer outputs performance data, now configured via
"fan" rule
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.7i1
+Date: 1421850987
+Class: feature
+
+This check is now configured via a different WATO rule, so any old rules set will
+no longer apply. Re-inventory required.
diff --git a/ChangeLog b/ChangeLog
index 024d3ac..2ca18de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,6 +48,8 @@
NOTE: Please refer to the migration notes!
* 1525 viprinet_temp: Now uses new Temperature WATO rule...
NOTE: Please refer to the migration notes!
+ * 1526 climaveneta_fan: No longer outputs performance data, now configured via
"fan" rule...
+ NOTE: Please refer to the migration notes!
* 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/climaveneta_fan b/checkman/climaveneta_fan
index 31978da..ff64db7 100644
--- a/checkman/climaveneta_fan
+++ b/checkman/climaveneta_fan
@@ -10,13 +10,11 @@ item:
The id of the fan (1 or 2)
perfdata:
- the current fan speed in RPM
+ None
inventory:
For each fan one service is created
[parameters]
-lower_warning (int): Warning if speed is beneath
-lower_critical (int): Minimum level for the speed
-upper_warning (int): Warning if the speed is above
-upper_critical (int): Maximum level for the speed
+warn (int): Warning if speed is below
+crit (int): Critical if speed is below
diff --git a/checks/climaveneta_fan b/checks/climaveneta_fan
index 63d6672..09d135a 100644
--- a/checks/climaveneta_fan
+++ b/checks/climaveneta_fan
@@ -25,39 +25,26 @@
# Boston, MA 02110-1301 USA.
-factory_settings["climaveneta_fan_default_levels"] = {
- "lower" : ( 200, 100 ),
- "upper" : ( 700, 800 ),
-}
+climaveneta_fan_default_levels = (200, 100)
def inventory_climaveneta_fan(info):
if len(info[0]) == 2:
- return [ (1, {}), (2, {}) ]
+ return [ (1, climaveneta_fan_default_levels), (2, climaveneta_fan_default_levels)
]
def check_climaveneta_fan(item, params, info):
rpm = int(info[0][item - 1])
- l_warn, l_crit = params['lower']
- u_warn, u_crit = params['upper']
- perfdata = [("rpm", rpm )]
- message = "Speed at %d RPM" % rpm
- if rpm <= l_crit or rpm >= u_crit:
- return 2, message, perfdata
- elif rpm <= l_warn or rpm >= u_warn:
- return 1, message, perfdata
- else:
- return 0, message, perfdata
+ return check_fan(rpm, params)
check_info["climaveneta_fan"] = {
"check_function" : check_climaveneta_fan,
"inventory_function" : inventory_climaveneta_fan,
"service_description" : "Fan %s",
- "has_perfdata" : True,
"snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.1.0") == "pCO Gateway",
"snmp_info" : (".1.3.6.1.4.1.9839.2.1.2", [ 42, 43
] ),
- "group" : "hw_fans",
- "default_levels_variable" : "climaveneta_fan_default_levels",
+ "group" : "fan",
+ "includes" : [ "fan.include" ],
}
diff --git a/checks/fan.include b/checks/fan.include
new file mode 100644
index 0000000..6acb00d
--- /dev/null
+++ b/checks/fan.include
@@ -0,0 +1,38 @@
+#!/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 check_fan(rpm, params):
+ warn, crit = params
+ message = "Speed at %d rpm" % rpm
+ levelstext = " (warn/crit at %s/%s rpm)" % params
+ if rpm < crit:
+ message += levelstext
+ return 2, message
+ elif rpm < warn:
+ message += levelstext
+ return 1, message
+ else:
+ return 0, message
diff --git a/checks/temperature.include b/checks/temperature.include
index 7b41d69..beeadc4 100644
--- a/checks/temperature.include
+++ b/checks/temperature.include
@@ -41,7 +41,6 @@ def celsius_to_fahrenheit(tempc):
# dev_level_lower: lower warn/crit device levels
# dev_status: temperature state (0, 1, 2) as the device reports it (if applies)
# Note: you must not specify dev_status and dev_levels at the same time!
-#
def check_temperature(reading, params, dev_unit = "c",
dev_levels = None, dev_levels_lower = None, dev_status = None):
@@ -209,7 +208,7 @@ def check_temperature(reading, params, dev_unit = "c",
# Render actual temperature, e.g. "17.8 °F"
infotext = "%s %s" % (render_temp(temp), unitsym[output_unit])
- # In case of a non-OK status ouput the information about the levels
+ # In case of a non-OK status output the information about the levels
if status != 0:
usr_levelstext = ""
usr_levelstext_lower = ""
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 8ae9352..21dc4f3 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -5608,6 +5608,30 @@ register_check_parameters(
)
register_check_parameters(
+ subgroup_environment,
+ "fan",
+ _("Fan speed"),
+ Tuple(
+ elements = [
+ Integer(
+ title = _("Warning below"),
+ default_value = 200,
+ unit = u"rpm",
+ ),
+ Integer(
+ title = _("Critical below"),
+ default_value = 100,
+ unit = u"rpm",
+ ),
+ ]
+ ),
+ TextAscii(
+ title = _("Fan Name"),
+ help = _("The identificator of the fan.")),
+ None
+)
+
+register_check_parameters(
subgroup_os,
"pf_used_states",
_("Number of used states of OpenBSD PF engine"),