Module: check_mk
Branch: master
Commit: 803268906e5af6788f463961135367bb624255b6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=803268906e5af6…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Mar 16 12:13:49 2015 +0100
check_cpu_peaks: use MAX, show OK if no data available, fix exception handling
---
doc/treasures/active_checks/check_cpu_peaks | 36 +++++++++++++++++++++------
1 file changed, 29 insertions(+), 7 deletions(-)
diff --git a/doc/treasures/active_checks/check_cpu_peaks b/doc/treasures/active_checks/check_cpu_peaks
index 6b4ab20..6e123b0 100755
--- a/doc/treasures/active_checks/check_cpu_peaks
+++ b/doc/treasures/active_checks/check_cpu_peaks
@@ -26,6 +26,13 @@
import sys, os, time, pprint, getopt
+class MKGeneralException(Exception):
+ def __init__(self, reason):
+ self.reason = reason
+ def __str__(self):
+ return self.reason
+
+
# Note: This check only works in an OMD environment!
sys.path.append(os.path.expanduser("~/share/check_mk/modules"))
execfile(os.path.expanduser("~/etc/check_mk/defaults"), globals())
@@ -46,21 +53,23 @@ ARGUMENTS:
HOST Host
OPTIONS:
- -v Verbose mode, Outputs RRD data
-w Return WARN if this value (integer) is never breached in the check period
-c Return CRIT if this value (integer) is never breached in the check period
-u Until time (unixtimestamp)
-f From time (unixtimestamp), default is until time minus 30 days
+ -v Verbose mode, Outputs RRD data
+ -d Debug mode - let Python exceptions come through
""")
if len(sys.argv) < 2:
usage()
sys.exit(1)
-short_options = "vw:c:f:u:"
+short_options = "vw:c:f:u:d"
opts, args = getopt.getopt(sys.argv[1:], short_options)
opt_verbose = False
+opt_debug = False
host = None
warn_level = None
crit_level = None
@@ -70,6 +79,8 @@ untiltime = None
for o,a in opts:
if o in [ '-v' ]:
opt_verbose = True
+ elif o in [ '-d' ]:
+ opt_debug = True
elif o in [ '-w' ]:
warn_level = int(a)
elif o in [ '-c' ]:
@@ -96,15 +107,17 @@ try:
util_total = []
is_windows = True
try:
- data = get_rrd_data(host, "CPU utilization", "util", "AVERAGE", fromtime, untiltime)
+ data = get_rrd_data(host, "CPU utilization", "util", "MAX", fromtime, untiltime)
datasets.append(data[1])
step_secs = data[0]
util_total = [ x for x in datasets[0] if x != None ]
except Exception, e:
+ if opt_debug:
+ raise
# looks like this is not a windows rrd...
is_windows = False
for key in ["system", "user", "wait"]:
- data = get_rrd_data(host, "CPU utilization", key, "AVERAGE", fromtime, untiltime)
+ data = get_rrd_data(host, "CPU utilization", key, "MAX", fromtime, untiltime)
datasets.append(data[1])
step_secs = data[0]
util_total = map(lambda x: int(sum([y for y in x if y != None])),
@@ -141,9 +154,18 @@ try:
state = 1
print ", ".join(info)
sys.exit(state)
+
+except MKGeneralException, e:
+ if opt_debug:
+ raise
+ print "OK - " + str(e)
+ sys.exit(0)
+
except Exception, e:
- # TODO: Exception handling could be improved.
+ if opt_debug:
+ raise
+ # TODO: Exception handling could be improved.
# Right now no handling of MKGeneralException, etc. is implemented
- print "Exception while processing data.", e
- sys.exit(2)
+ print "UNKNOWN - " + str(e)
+ sys.exit(3)
Module: check_mk
Branch: master
Commit: da7c18abc5a226d8fa25482c40cb509898a007e1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=da7c18abc5a226…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Mar 16 10:11:49 2015 +0100
Revert "#1230 FIX Fixed possible encoding problem with useres containing non ASCII Characters"
This reverts commit 65d553a3f1830060e8a3e4eaf2e5c1719b2d8dba.
---
.werks/1230 | 10 ----------
ChangeLog | 1 -
web/htdocs/lib.py | 1 -
3 files changed, 12 deletions(-)
diff --git a/.werks/1230 b/.werks/1230
deleted file mode 100644
index 80ba941..0000000
--- a/.werks/1230
+++ /dev/null
@@ -1,10 +0,0 @@
-Title: Fixed possible encoding problem with useres containing non ASCII Characters
-Level: 1
-Component: wato
-Class: fix
-Compatible: compat
-State: unknown
-Version: 1.2.7i1
-Date: 1426493622
-
-
diff --git a/ChangeLog b/ChangeLog
index 57609a7..8b2778a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -354,7 +354,6 @@
* 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...
- * 1230 FIX: Fixed possible encoding problem with useres containing non ASCII Characters
Notifications:
* 1662 notification plugin spectrum: finalized script. now able to handle host notications
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index fd56acf..7e0ffe5 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -82,7 +82,6 @@ class MKInternalError(MKException):
# Create directory owned by common group of Nagios and webserver,
# and make it writable for the group
def make_nagios_directory(path):
- path = path.decode('utf-8')
if not os.path.exists(path):
parent_dir, lastpart = path.rstrip('/').rsplit('/', 1)
make_nagios_directory(parent_dir)
Module: check_mk
Branch: master
Commit: 65d553a3f1830060e8a3e4eaf2e5c1719b2d8dba
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=65d553a3f18300…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Mar 16 09:15:00 2015 +0100
#1230 FIX Fixed possible encoding problem with useres containing non ASCII Characters
---
.werks/1230 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/lib.py | 1 +
3 files changed, 12 insertions(+)
diff --git a/.werks/1230 b/.werks/1230
new file mode 100644
index 0000000..80ba941
--- /dev/null
+++ b/.werks/1230
@@ -0,0 +1,10 @@
+Title: Fixed possible encoding problem with useres containing non ASCII Characters
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1426493622
+
+
diff --git a/ChangeLog b/ChangeLog
index ab4a302..e7ad11f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -353,6 +353,7 @@
* 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...
+ * 1230 FIX: Fixed possible encoding problem with useres containing non ASCII Characters
Notifications:
* 1662 notification plugin spectrum: finalized script. now able to handle host notications
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index 7e0ffe5..fd56acf 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -82,6 +82,7 @@ class MKInternalError(MKException):
# Create directory owned by common group of Nagios and webserver,
# and make it writable for the group
def make_nagios_directory(path):
+ path = path.decode('utf-8')
if not os.path.exists(path):
parent_dir, lastpart = path.rstrip('/').rsplit('/', 1)
make_nagios_directory(parent_dir)
Module: check_mk
Branch: master
Commit: e8cc79d9129a1bdbd4701a6b0673de5b77dcdee8
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e8cc79d9129a1b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 16 08:36:40 2015 +0100
When performing a self test the check raise an alert that
the device is "on battery". The check now checks the self
test state and ignores the on battery state during this time.
The check has been cleaned up a lot to be more maintainable and
modern.
Conflicts:
ChangeLog
checks/apc_symmetra
---
.werks/2097 | 15 ++++
ChangeLog | 1 +
checks/apc_symmetra | 245 ++++++++++++++++++++-------------------------------
3 files changed, 111 insertions(+), 150 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=e8cc79d912…