Module: check_mk
Branch: master
Commit: d64c844e038cdb5effdcd8431e54a184ec9e772a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d64c844e038cdb…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Mar 6 17:30:45 2015 +0100
#2047 FIX Allow overriding existing WATO rules by own files in local/ hierarchy
If you would define your own version of a check parameter rule set in a
file in <tt>local/share/check_mk/web/plugin/wato/myfile.py</tt>, then the
rule would appear twice in the rule search. This has been fixed. You
can now safely override rules in your own extensions.
---
.werks/2047 | 13 +++++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 7 +++++++
3 files changed, 21 insertions(+)
diff --git a/.werks/2047 b/.werks/2047
new file mode 100644
index 0000000..6628bf0
--- /dev/null
+++ b/.werks/2047
@@ -0,0 +1,13 @@
+Title: Allow overriding existing WATO rules by own files in local/ hierarchy
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1425659357
+
+If you would define your own version of a check parameter rule set in a
+file in <tt>local/share/check_mk/web/plugin/wato/myfile.py</tt>, then the
+rule would appear twice in the rule search. This has been fixed. You
+can now safely override rules in your own extensions.
diff --git a/ChangeLog b/ChangeLog
index a198637..4578bce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -329,6 +329,7 @@
* 2080 FIX: Fixed UnicodeDecodeError when using a localized GUI on notification configuration page
* 2084 FIX: Disabled notification for a user is now shown on profile page even when not permitted to edit...
* 2045 FIX: Avoid fetching SNMP data when showing service list in WATO - unless Full Scan is pressed
+ * 2047 FIX: Allow overriding existing WATO rules by own files in local/ hierarchy...
Notifications:
* 1662 notification plugin spectrum: finalized script. now able to handle host notications
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 6c7f747..9019f4e 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -15317,6 +15317,13 @@ def register_rule(group, varname, valuespec = None, title = None,
g_rulespec_groups.append((group, rulesets))
g_rulespec_group[group] = rulesets
else:
+ # If a ruleset for this variable already exist, then we need to replace
+ # it. How can this happen? If a user puts his own copy of the definition
+ # into some file below local/.
+ for nr, rs in enumerate(g_rulespec_group[group]):
+ if rs["varname"] == varname:
+ del g_rulespec_group[group][nr]
+ break # There cannot be two duplicates!
g_rulespec_group[group].append(ruleset)
g_rulespecs[varname] = ruleset
Module: check_mk
Branch: master
Commit: 71717bf7342237257cca61c22fbe482781436839
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=71717bf7342237…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Fri Mar 6 12:58:49 2015 +0100
#1867 ibm_imm_voltage: new check to monitor power supply and CMS battery voltages on servers via IBMs IMM
---
.werks/1867 | 9 ++++++
ChangeLog | 1 +
checkman/ibm_imm_voltage | 23 +++++++++++++++
checks/ibm_imm_voltage | 71 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 104 insertions(+)
diff --git a/.werks/1867 b/.werks/1867
new file mode 100644
index 0000000..83b1310
--- /dev/null
+++ b/.werks/1867
@@ -0,0 +1,9 @@
+Title: ibm_imm_voltage: new check to monitor power supply and CMS battery voltages on servers via IBMs IMM
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1425643084
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 55b0f0d..54ea7c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -112,6 +112,7 @@
* 2044 IBM SVC checks: renamed services, remove bogus IBM SVC...
* 1894 hwg_humidity: New check to monitor humidity sensors attached to HWg-STE...
* 1866 ibm_imm_fan, ibm_imm_temp: new checks to monitor fans and temp sensors on IBM Servers via the IMM
+ * 1867 ibm_imm_voltage: new check to monitor power supply and CMS battery voltages on servers via IBMs IMM
* 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/ibm_imm_voltage b/checkman/ibm_imm_voltage
new file mode 100644
index 0000000..383a11a
--- /dev/null
+++ b/checkman/ibm_imm_voltage
@@ -0,0 +1,23 @@
+title: Voltages of Power Supply and CMOS Battery via IBM Integrated Management Module (IMM)
+agents: snmp
+catalog: hw/server/ibm
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the voltages provided by the power supply and CMOS
+ battery of servers via a IBM Integrated Management Module (IMM). It uses
+ snmp and the IBM IMM MIB to gather the data.
+
+ The check uses the lower and upper warning and critical levels extracted
+ from the device (OIDs {voltCritLimitLow}, {voltNonCritLimitLow},
+ {voltCritLimitHigh} ,{voltNonCritLimitHigh}) to calculate the state of
+ the service.
+
+inventory:
+ The service discovery will find one service per voltage measurement channel
+
+item:
+ The name of the power supply measurement channel as extracted from the OID {voltDescr}
+
+perfdata:
+ The voltage of the measurement channel
diff --git a/checks/ibm_imm_voltage b/checks/ibm_imm_voltage
new file mode 100644
index 0000000..694014f
--- /dev/null
+++ b/checks/ibm_imm_voltage
@@ -0,0 +1,71 @@
+#!/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.
+
+def inventory_ibm_imm_voltage(info):
+ for line in info:
+ yield line[0], None
+
+def check_ibm_imm_voltage(item, _no_params, info):
+ for line in info:
+ if line[0] == item:
+ volt, crit, warn, crit_low, warn_low = map(lambda v: float(v)/1000, line[1:])
+ infotext = "%.2f Volt" % volt
+
+ perfdata = [ ("volt", volt, str(warn_low)+":"+str(warn), str(crit_low)+":"+str(crit)) ]
+ levelstext = " (levels warn/crit lower: %.1f/%.1f upper: %.1f/%.1f)" % (warn_low, crit_low, warn, crit)
+
+ if (crit_low and volt <= crit_low) or (crit and volt >= crit):
+ state = 2
+ infotext += levelstext
+ elif (warn_low and volt <= warn_low) or (warn and volt >= warn):
+ state = 1
+ infotext += levelstext
+ else:
+ state = 0
+
+ return state, infotext, perfdata
+
+check_info["ibm_imm_voltage"] = {
+ 'check_function' : check_ibm_imm_voltage,
+ 'inventory_function' : inventory_ibm_imm_voltage,
+ 'service_description' : 'Voltage %s',
+ 'has_perdata' : True,
+ 'snmp_scan_function' :
+ lambda oid: oid('.1.3.6.1.2.1.1.1.0').lower().endswith(" mips") or \
+ oid('.1.3.6.1.2.1.1.1.0').lower().endswith(" sh4a"),
+ 'snmp_info' : ('.1.3.6.1.4.1.2.3.51.3.1.2.2.1', [ # voltTable.voltEntry
+ #1, # voltIndex
+ 2, # voltDescr
+ 3, # voltReading
+ #4, # voltNominalReading
+ #5, # voltNonRecovLimitHigh
+ 6, # voltCritLimitHigh
+ 7, # voltNonCritLimitHigh
+ #8, # voltNonRecovLimitLow
+ 9, # voltCritLimitLow
+ 10, # voltNonCritLimitLow
+ ]),
+}