Module: check_mk
Branch: master
Commit: 5fe55e423bd4e55c2e6a5ae306bfbafd06e84878
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5fe55e423bd4e5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 21 14:44:13 2016 +0100
3333 FIX Predictive levels: Improved error handling in case no RRDs have been created yet
---
.werks/3333 | 10 ++++++++++
ChangeLog | 1 +
modules/check_mk_base.py | 6 ++++++
modules/prediction.py | 3 +++
4 files changed, 20 insertions(+)
diff --git a/.werks/3333 b/.werks/3333
new file mode 100644
index 0000000..1a246ca
--- /dev/null
+++ b/.werks/3333
@@ -0,0 +1,10 @@
+Title: Predictive levels: Improved error handling in case no RRDs have been created yet
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1458567828
+
+
diff --git a/ChangeLog b/ChangeLog
index e5371d9..0df8071 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -96,6 +96,7 @@
* 3299 FIX: mssql_backup: Fixed exception in case of invalid agent output
* 3300 FIX: zfsget: Fixed excluding snapshots from zfsget section
* 3301 FIX: mrpe: Fixed exception "urllib not defined" when using Nagios as
core
+ * 3333 FIX: Predictive levels: Improved error handling in case no RRDs have been
created yet
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 422c90f..991338f 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -2113,6 +2113,12 @@ def check_levels(value, dsname, params, unit="",
factor=1.0, scale=1.0, statemar
infotexts.append("predicted reference: %.2f%s" % (ref_value /
scale, unit))
else:
infotexts.append("no reference for prediction yet")
+
+ except MKGeneralException, e:
+ ref_value = None
+ warn_upper, crit_upper, warn_lower, crit_lower = None, None, None, None
+ infotexts.append("no reference for prediction (%s)" % e)
+
except Exception, e:
if opt_debug:
raise
diff --git a/modules/prediction.py b/modules/prediction.py
index 4700911..53d3cb8 100644
--- a/modules/prediction.py
+++ b/modules/prediction.py
@@ -48,6 +48,9 @@ def get_rrd_data(hostname, service_description, varname, cf, fromtime,
untiltime
raise
raise MKGeneralException("Cannot get historic metrics via Livestatus:
%s" % e)
+ if not response:
+ raise MKGeneralException("Got no historic metrics")
+
real_fromtime, real_untiltime, step = response[:3]
values = response[3:]
return step, values