Module: check_mk
Branch: master
Commit: 6a3ba74f1b332c99e797f5d6e142f5378a64dc02
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6a3ba74f1b332c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Aug 18 22:24:57 2011 +0200
local: PNP graph now supports multiple values
---
.bugs/164 | 10 ++++--
ChangeLog | 1 +
pnp-templates/check_mk-local.php | 60 +++++++++++++++++++++-----------------
3 files changed, 41 insertions(+), 30 deletions(-)
diff --git a/.bugs/164 b/.bugs/164
index 488bdad..8958da8 100644
--- a/.bugs/164
+++ b/.bugs/164
@@ -1,13 +1,17 @@
Title: PNP template for local check should support multiple values
Component: checks
+State: done
+Class: bug
+Date: 2011-03-01 11:21:46
Benefit: 1
-State: open
Cost: 2
-Date: 2011-03-01 11:21:46
-Class: bug
+Fun: 0
Currently only one value is painted. The best way would be probably
to call the PNP default template in case no special local template
is existent.
Beware: we must look in all template dirs for the default template.
+
+2011-08-18 22:23:21: changed state open -> done
+Loop over all values and paint one graph for each value now. In 8 different nice colors.
diff --git a/ChangeLog b/ChangeLog
index a4a833a..1f5736c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
* mk_logwatch: allow to set limits in processing time and number of
new log messages per log file
* Windows Agent: Now supports direct execution of powershell scripts
+ * local: PNP template now supports multiple performance values
MK Livestatus:
* WaitObject: allow to separate host name and service with a semicolon.
diff --git a/pnp-templates/check_mk-local.php b/pnp-templates/check_mk-local.php
index 9e55712..a6d7426 100644
--- a/pnp-templates/check_mk-local.php
+++ b/pnp-templates/check_mk-local.php
@@ -45,34 +45,40 @@ foreach ($template_dirs as $template_dir) {
}
}
-if (!$found) {
- $def[1] = "DEF:cnt=$RRDFILE[1]:$DS[1]:MAX ";
- $def[1] .= "AREA:cnt#00ffc6:\"$servicedesc\" ";
- $def[1] .= "LINE1:cnt#226600: ";
+# Use another color for each graph. After eight graphs colors wrap around.
+$area_colors = array( "beff5f", "5fffef", "5faaff",
"cc5fff", "ff5fe2", "ff5f6c", "ff975f",
"ffec5f");
+$line_colors = array( "5f7a2f", "2f8077", "2f5580",
"662f80", "802f71", "802f36", "804b2f",
"80762f");
- $upper = "";
- $lower = " -l 0";
- if ($WARN[1] != "") {
- $def[1] .= "HRULE:$WARN[1]#ffff00:\"Warning\" ";
- }
- if ($CRIT[1] != "") {
- $def[1] .= "HRULE:$CRIT[1]#ff0000:\"Critical\" ";
- }
- if ($MIN[1] != "") {
- $lower = " -l " . $MIN[1];
- $minimum = $MIN[1];
- }
- if ($MAX[1] != "") {
- $upper = " -u" . $MAX[1];
- $def[1] .= "HRULE:$MAX[1]#0000b0:\"Upper limit\" ";
- }
-
- $opt[1] = "$lower $upper --title '$hostname: $servicedesc' ";
- $def[1] .= "GPRINT:cnt:LAST:\"current\: %6.2lf\" ";
- $def[1] .= "GPRINT:cnt:MAX:\"max\: %6.2lf\" ";
- $def[1] .= "GPRINT:cnt:AVERAGE:\"avg\: %6.2lf\" ";
+if (!$found) {
+ foreach ($RRDFILE as $i => $RRD) {
+ $ii = $i % 8;
+ $name = $NAME[$i];
+ $def[$i] = "DEF:cnt=$RRDFILE[$i]:$DS[$i]:MAX ";
+ $def[$i] .= "AREA:cnt#$area_colors[$ii]:\"$name\" ";
+ $def[$i] .= "LINE1:cnt#$line_colors[$ii]: ";
+
+ $upper = "";
+ $lower = " -l 0";
+ if ($WARN[$i] != "") {
+ $def[$i] .= "HRULE:$WARN[$i]#ffff00:\"Warning\" ";
+ }
+ if ($CRIT[$i] != "") {
+ $def[$i] .= "HRULE:$CRIT[$i]#ff0000:\"Critical\" ";
+ }
+ if ($MIN[$i] != "") {
+ $lower = " -l " . $MIN[$i];
+ $minimum = $MIN[$i];
+ }
+ if ($MAX[$i] != "") {
+ $upper = " -u" . $MAX[$i];
+ $def[$i] .= "HRULE:$MAX[$i]#0000b0:\"Upper limit\" ";
+ }
+
+ $opt[$i] = "$lower $upper --title '$hostname: $servicedesc - $name'
";
+ $def[$i] .= "GPRINT:cnt:LAST:\"current\: %6.2lf\" ";
+ $def[$i] .= "GPRINT:cnt:MAX:\"max\: %6.2lf\" ";
+ $def[$i] .= "GPRINT:cnt:AVERAGE:\"avg\: %6.2lf\" ";
+ }
}
-
?>
-