Module: check_mk
Branch: master
Commit: 55fd5f484e26d7f82c780f34d3cd9f85248ed6a8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=55fd5f484e26d7…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Oct 21 13:42:52 2013 +0200
apache_status: If ReqPerSec and BytesPerSec are not reported by the agent, no PNP graphs
for them are drawn. (This is the case if ExtendedStatus set to Off in Apache config)
---
ChangeLog | 4 ++++
pnp-templates/check_mk-apache_status.php | 34 +++++++++++++++++-------------
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index aff52a1..939a72a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -69,6 +69,10 @@
in order to make it consistent with the other temperature checks
* FIX: hp_blade_blades: Fixed crash on inventory when receiving
unexpected snmp data
+ * FIX: apache_status: If ReqPerSec and BytesPerSec are not reported by
+ the agent, no PNP graphs for them are drawn.
+ (This is the case if ExtendedStatus set to Off in Apache config)
+
WATO:
* You can now have site-specific global settings when using
diff --git a/pnp-templates/check_mk-apache_status.php
b/pnp-templates/check_mk-apache_status.php
index 47b81db..74ef885 100644
--- a/pnp-templates/check_mk-apache_status.php
+++ b/pnp-templates/check_mk-apache_status.php
@@ -76,27 +76,31 @@ foreach ($this->DS as $KEY=>$VAL) {
# Requests per Second
#
$i++;
-$def[$i] = "";
-$opt[$i] = " --title '$hostname: $servicedesc Requests/sec' ";
-$color = '#000000';
-foreach ($this->DS as $KEY=>$VAL) {
- if($VAL['NAME'] == 'ReqPerSec') {
- $def[$i] .= rrd::def ("var".$KEY, $VAL['RRDFILE'],
$VAL['DS'], "AVERAGE");
- $def[$i] .= rrd::line1 ("var".$KEY, $color,
rrd::cut($VAL['NAME'],16), 'STACK' );
- $def[$i] .= rrd::gprint ("var".$KEY,
array("LAST","MAX","AVERAGE"), "%6.1lf/s");
+if (isset($RRD["ReqPerSec"])) {
+ $def[$i] = "";
+ $opt[$i] = " --title '$hostname: $servicedesc Requests/sec' ";
+ $color = '#000000';
+ foreach ($this->DS as $KEY=>$VAL) {
+ if($VAL['NAME'] == 'ReqPerSec') {
+ $def[$i] .= rrd::def ("var".$KEY, $VAL['RRDFILE'],
$VAL['DS'], "AVERAGE");
+ $def[$i] .= rrd::line1 ("var".$KEY, $color,
rrd::cut($VAL['NAME'],16), 'STACK' );
+ $def[$i] .= rrd::gprint ("var".$KEY,
array("LAST","MAX","AVERAGE"), "%6.1lf/s");
+ }
}
}
#
# Bytes per Second
#
$i++;
-$def[$i] = "";
-$opt[$i] = " --title '$hostname: $servicedesc Bytes per Second'";
-foreach ($this->DS as $KEY=>$VAL) {
- if($VAL['NAME'] == 'BytesPerSec') {
- $def[$i] .= rrd::def ("var".$KEY, $VAL['RRDFILE'],
$VAL['DS'], "AVERAGE");
- $def[$i] .= rrd::line1 ("var".$KEY,
rrd::color($KEY),rrd::cut($VAL['NAME'],16), 'STACK' );
- $def[$i] .= rrd::gprint ("var".$KEY,
array("LAST","MAX","AVERAGE"), "%6.1lf %sb/s");
+if (isset($RRD["ReqPerSec"])) {
+ $def[$i] = "";
+ $opt[$i] = " --title '$hostname: $servicedesc Bytes per
Second'";
+ foreach ($this->DS as $KEY=>$VAL) {
+ if($VAL['NAME'] == 'BytesPerSec') {
+ $def[$i] .= rrd::def ("var".$KEY, $VAL['RRDFILE'],
$VAL['DS'], "AVERAGE");
+ $def[$i] .= rrd::line1 ("var".$KEY,
rrd::color($KEY),rrd::cut($VAL['NAME'],16), 'STACK' );
+ $def[$i] .= rrd::gprint ("var".$KEY,
array("LAST","MAX","AVERAGE"), "%6.1lf %sb/s");
+ }
}
}
?>