Module: check_mk
Branch: master
Commit: 8c14ba411f46e88b73d8ab3f414d34e460f4c383
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8c14ba411f46e8…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Jun 30 13:07:03 2014 +0200
FIX apc_symmetra_test: Handle unknown date of last self test as intended
If the date of last self test is reported to be unknown, up to now
the check broke. Now unknow status is handled as intended.
---
.werks/996 | 9 +++++++++
ChangeLog | 1 +
checks/apc_symmetra_test | 4 ++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/.werks/996 b/.werks/996
new file mode 100644
index 0000000..fdacbda
--- /dev/null
+++ b/.werks/996
@@ -0,0 +1,9 @@
+Title: apc_symmetra_test: Handle unknown date of last self test as intended
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1404126301
+Class: fix
+
+If the date of last self test is reported to be unknown, up to now
+the check broke. Now unknow status is handled as intended.
diff --git a/ChangeLog b/ChangeLog
index 39fba89..57cfc1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,7 @@
* 0944 FIX: oracle_tablespaces: fixed calculation of space left and number of remaining increments...
* 1032 FIX: check_traceroute: Fix option Use DNS, worked vice versa
* 0171 FIX: hp_blade_psu: Fixed pnp template...
+ * 0996 FIX: apc_symmetra_test: Handle unknown date of last self test as intended...
Multisite:
* 1013 Sort host names naturally, e.g. foobar11 comes after foobar2...
diff --git a/checks/apc_symmetra_test b/checks/apc_symmetra_test
index 7392ed6..c2946c2 100644
--- a/checks/apc_symmetra_test
+++ b/checks/apc_symmetra_test
@@ -64,8 +64,8 @@ def check_apc_test(item, params, info):
DiagnosticsResults = saveint(line[0])
LastDiagnosticsDate = line[1]
- if LastDiagnosticsDate == 'Unkown':
- return 3, "Date of last self test is unkown"
+ if LastDiagnosticsDate == 'Unknown':
+ return 3, "Date of last self test is unknown"
month, day, year = map(saveint, LastDiagnosticsDate.split('/'))
last_diag_date = datetime.date( year, month, day)
Module: check_mk
Branch: master
Commit: 2e60ca5fca090138c35688101190e49f9abfd42c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2e60ca5fca0901…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jun 30 11:54:40 2014 +0200
FIX Do not fail on errors in *.mk files anymore - except in interactive mode
If a syntax error in <tt>main.mk</tt> or other <tt>*.mk</tt> files occurs,
Check_MK used to abort any operation. This is nasty when for example a new
variable that has been introduced in a new version is not known in an older
version of Check_MK and thus after a version downgrade the configuration
cannot be activated any more.
The behaviour has now changed so that in case of such an error Check_MK will only
abort in <i>interactive</i> mode, i.e. if the standard output is a terminal.
That means that WATO will always try to activate Changes. You can force the
old behaviour by adding the new option <tt>--interactive</tt>.
Conflicts:
ChangeLog
modules/check_mk.py
---
.werks/1035 | 18 ++++++++++++++++++
ChangeLog | 1 +
modules/check_mk.py | 22 +++++++++++++++++-----
3 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/.werks/1035 b/.werks/1035
new file mode 100644
index 0000000..4975cee
--- /dev/null
+++ b/.werks/1035
@@ -0,0 +1,18 @@
+Title: Do not fail on errors in *.mk files anymore - except in interactive mode
+Level: 2
+Component: core
+Class: fix
+State: unknown
+Version: 1.2.5i5
+Date: 1404121324
+
+If a syntax error in <tt>main.mk</tt> or other <tt>*.mk</tt> files occurs,
+Check_MK used to abort any operation. This is nasty when for example a new
+variable that has been introduced in a new version is not known in an older
+version of Check_MK and thus after a version downgrade the configuration
+cannot be activated any more.
+
+The behaviour has now changed so that in case of such an error Check_MK will only
+abort in <i>interactive</i> mode, i.e. if the standard output is a terminal.
+That means that WATO will always try to activate Changes. You can force the
+old behaviour by adding the new option <tt>--interactive</tt>.
diff --git a/ChangeLog b/ChangeLog
index 39fba89..3d199fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
Core & Setup:
* 1012 Fix quoting of backslashes in custom checks with nagios core...
NOTE: Please refer to the migration notes!
+ * 1035 FIX: Do not fail on errors in *.mk files anymore - except in interactive mode...
Checks & Agents:
* 0168 f5_bigip_pool: Added Wato configuration...
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 78c4403..9e943f5 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -37,6 +37,7 @@ g_profile_path = 'profile.out'
if __name__ == "__main__":
opt_debug = '--debug' in sys.argv[1:]
+ opt_interactive = '--interactive' in sys.argv[1:]
opt_verbose = '-v' in sys.argv[1:] or '--verbose' in sys.argv[1:]
if '--profile' in sys.argv[1:]:
import cProfile
@@ -48,6 +49,7 @@ if __name__ == "__main__":
else:
opt_verbose = False
opt_debug = False
+ opt_interactive = False
#.
# .--Pathnames-----------------------------------------------------------.
@@ -122,6 +124,12 @@ def verbose(t):
sys.stderr.write(t)
sys.stderr.flush()
+# Abort after an error, but only in interactive mode.
+def interactive_abort(error):
+ if sys.stdout.isatty() or opt_interactive:
+ sys.stderr.write(error + "\n")
+ sys.exit(1)
+
# During setup a file called defaults is created in the modules
# directory. In this file all directories are configured. We need to
@@ -4741,6 +4749,9 @@ OPTIONS:
prevents DNS lookups.
--usewalk use snmpwalk stored with --snmpwalk
--debug never catch Python exceptions
+ --interactive Some errors are only reported in interactive mode, i.e. if stdout
+ is a TTY. This option forces interactive mode even if the output
+ is directed into a pipe or file.
--procs N start up to N processes in parallel during --scan-parents
--checks A,.. restrict checks/inventory to specified checks (tcp/snmp/check type)
--keepalive used by Check_MK Mirco Core: run check and --notify in continous
@@ -5615,11 +5626,10 @@ def read_config_files(with_autochecks=True, with_conf_d=True):
marks_hosts_with_path(_old_all_hosts, all_hosts, _f)
marks_hosts_with_path(_old_clusters, clusters.keys(), _f)
except Exception, e:
- sys.stderr.write("Cannot read in configuration file %s:\n%s\n" % (_f, e))
- if __name__ == "__main__":
- sys.exit(3)
- else:
+ if opt_debug:
raise
+ else:
+ interactive_abort("Cannot read in configuration file %s: %s" % (_f, e))
# Strip off host tags from the list of all_hosts. Host tags can be
# appended to the hostnames in all_hosts, separated by pipe symbols,
@@ -5878,7 +5888,7 @@ def output_profile():
# if check_mk is not called as module
if __name__ == "__main__":
short_options = 'ASHVLCURODMmd:Ic:nhvpXPNBil'
- long_options = [ "help", "version", "verbose", "compile", "debug",
+ long_options = [ "help", "version", "verbose", "compile", "debug", "interactive",
"list-checks", "list-hosts", "list-tag", "no-tcp", "cache",
"flush", "package", "localize", "donate", "snmpwalk", "oid=", "extraoid=",
"snmptranslate", "bake-agents",
@@ -5944,6 +5954,8 @@ if __name__ == "__main__":
opt_nowiki = True
elif o == '--debug':
opt_debug = True
+ elif o == '--interactive':
+ opt_interactive = True
elif o == '-I':
seen_I += 1
elif o == "--checks":
Module: check_mk
Branch: master
Commit: 8b6f717760b25c7ef374324ce3abbbbf271eb30c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8b6f717760b25c…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Jun 27 14:25:37 2014 +0200
hp_proliant_power: New check to monitor the Power Meter on Prolaint Servers and iLO Boards
---
.werks/170 | 8 +++++
ChangeLog | 1 +
checkman/hp_proliant_power | 16 +++++++++
checks/hp_proliant_power | 68 ++++++++++++++++++++++++++++++++++++
web/plugins/perfometer/check_mk.py | 1 +
5 files changed, 94 insertions(+)
diff --git a/.werks/170 b/.werks/170
new file mode 100644
index 0000000..9ce90f1
--- /dev/null
+++ b/.werks/170
@@ -0,0 +1,8 @@
+Title: hp_proliant_power: New check to monitor the Power Meter on Prolaint Servers and iLO Boards
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1403871902
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 7bb5f9c..2cdb7ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
* 0168 f5_bigip_pool: Added Wato configuration...
* 0995 raritan_pdu_outletcount: new check for outlet count of Raritan PX-2000 family PDUs
* 0169 websphere_mq_channels,ebsphere_mq_queues: New Checks to monitor IBM Websphere MQ Queues and Channels...
+ * 0170 hp_proliant_power: New check to monitor the Power Meter on Prolaint Servers and iLO Boards
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output of if checks...
diff --git a/checkman/hp_proliant_power b/checkman/hp_proliant_power
new file mode 100644
index 0000000..51f6ab7
--- /dev/null
+++ b/checkman/hp_proliant_power
@@ -0,0 +1,16 @@
+title: HP Proliant Servers: Power Meter
+agents: snmp
+catalog: hw/server/hp
+license: GPL
+distribution: check_mk
+description:
+ This check connects to the SNMP agent installed on an operating system
+ on a HP Proliant server (or iLO Board) and reads the information from the {CPQHLTH-MIB}
+ MIB.
+ The systems SNMP agent is extended by the HP Management Agents which need
+ to be installed on the monitored systems.
+
+ The check monitors the state of the power meter and his current reading in Watt.
+
+inventory:
+ One check is automatically created.
diff --git a/checks/hp_proliant_power b/checks/hp_proliant_power
new file mode 100755
index 0000000..f4cf877
--- /dev/null
+++ b/checks/hp_proliant_power
@@ -0,0 +1,68 @@
+#!/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.
+
+hp_prolaint_power_default_levels = ( 300, 400 )
+
+def inventory_hp_proliant_power(info):
+ if len(info) > 0:
+ return [ ( None, 'hp_prolaint_power_default_levels') ]
+
+def check_hp_proliant_power(item, params, info):
+ status_table = {
+ 1 : "other",
+ 3 : "absent",
+ }
+ status, reading = map(saveint, info[0])
+ if status != 2:
+ return 2, "Power Meter state: %s" % ( status_table[status] )
+ warn, crit = params
+ state = 0
+ levels = ''
+ if reading > crit:
+ state = 2
+ levels = '( Warning/Critical %s/%s )' % ( warn, crit )
+ elif reading > warn:
+ state = 1
+ levels = '( Warning/Critical %s/%s )' % ( warn, crit )
+
+ perf = [ ('watt', reading, warn, crit ) ]
+ return state, "Current reading: %d Watt" % reading + levels, perf
+
+check_info["hp_proliant_power"] = {
+ 'group' : 'epower',
+ 'check_function' : check_hp_proliant_power,
+ 'inventory_function' : inventory_hp_proliant_power,
+ 'service_description' : 'HW Power Meter',
+ 'snmp_info': (
+ ".1.3.6.1.4.1.232.6.2.15", [
+ "2", # cpqHePowerMeterStatus
+ "3", # cpqHePowerMeterCurrReading
+ ]
+ ),
+ 'snmp_scan_function' : \
+ lambda oid: "proliant" in oid(".1.3.6.1.4.1.232.2.2.4.2.0").lower(),
+ 'has_perfdata' : True
+}
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index dd8eba1..28951d8 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -375,6 +375,7 @@ def perfometer_power(row, check_command, perf_data):
perfometers["check_mk-dell_poweredge_amperage.power"] = perfometer_power
perfometers["check_mk-dell_chassis_power"] = perfometer_power
perfometers["check_mk-dell_chassis_powersupplies"] = perfometer_power
+perfometers["check_mk-hp-proliant_power"] = perfometer_power
def perfometer_users(row, check_command, perf_data):
state = row["service_state"]