Module: check_mk
Branch: master
Commit: 659de9a4a71d787537cbd2abee2766edf20926af
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=659de9a4a71d78…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Thu Feb 21 09:32:45 2019 +0100
7060 FIX oracle_sessions: show graphs in the cre if no absolute levels are set
If no absolute levels were given the graphs could not be shown in the
raw edition, because the pnp template assumed that the levels are
always present.
Change-Id: I3fc7c57bb600e07d0d7426e58382a1e4b3c72821
---
.werks/7060 | 13 +++++++++++++
pnp-templates/check_mk-oracle_sessions.php | 16 +++++++++++++---
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/.werks/7060 b/.werks/7060
new file mode 100644
index 0000000..765eb0e
--- /dev/null
+++ b/.werks/7060
@@ -0,0 +1,13 @@
+Title: oracle_sessions: show graphs in the cre if no absolute levels are set
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1550737544
+
+If no absolute levels were given the graphs could not be shown in the
+raw edition, because the pnp template assumed that the levels are
+always present.
diff --git a/pnp-templates/check_mk-oracle_sessions.php
b/pnp-templates/check_mk-oracle_sessions.php
index e278eb6..f245ed3 100644
--- a/pnp-templates/check_mk-oracle_sessions.php
+++ b/pnp-templates/check_mk-oracle_sessions.php
@@ -23,8 +23,14 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+$warn = $WARN[1];
+$crit = $CRIT[1];
+
$title = str_replace("_", " ", $servicedesc);
-$opt[1] = "--vertical-label 'active sessions' -l0 -u $CRIT[1] --title
\"$title\" ";
+$opt[1] = "--vertical-label 'active sessions' -l0 --title
\"$title\" ";
+if (is_numeric($crit)) {
+ $opt[1] .= "-u $crit ";
+}
$def[1] = "DEF:sessions=$RRDFILE[1]:$DS[1]:MAX ";
$def[1] .= "AREA:sessions#00ff48: ";
@@ -32,6 +38,10 @@ $def[1] .= "LINE:sessions#008f38: ";
$def[1] .= "GPRINT:sessions:LAST:\"last\: %3.0lf\" ";
$def[1] .= "GPRINT:sessions:AVERAGE:\"avg\: %3.0lf\" ";
$def[1] .= "GPRINT:sessions:MAX:\"max\: %3.0lf\" ";
-$def[1] .= "HRULE:$WARN[1]#ffcf00:\"Warning at $WARN[1]\" ";
-$def[1] .= "HRULE:$CRIT[1]#ff0000:\"Critical at $CRIT[1]\" ";
+if (is_numeric($warn)) {
+ $def[1] .= "HRULE:$warn#ffcf00:\"Warning at $warn\" ";
+}
+if (is_numeric($crit)) {
+ $def[1] .= "HRULE:$crit#ff0000:\"Critical at $crit\" ";
+}
?>