summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@xs4all.nl>2008-12-16 13:35:43 +0000
committerSeth Mos <seth.mos@xs4all.nl>2008-12-16 13:35:43 +0000
commit95919c394f413c7d8e02e4d3c80ca58dcdc15d96 (patch)
tree787831f4ab77ada06393cbc976e912a76567729d
parent77be57453e4c49f76f4904e4b5b64d9409f302f6 (diff)
downloadpfsense-95919c394f413c7d8e02e4d3c80ca58dcdc15d96.zip
pfsense-95919c394f413c7d8e02e4d3c80ca58dcdc15d96.tar.gz
reformat the the entire rrd graph generation page.
-rw-r--r--usr/local/www/status_rrd_graph_img.php935
1 files changed, 473 insertions, 462 deletions
diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php
index 3e0ea38..290dd35 100644
--- a/usr/local/www/status_rrd_graph_img.php
+++ b/usr/local/www/status_rrd_graph_img.php
@@ -3,7 +3,7 @@
/*
status_rrd_graph_img.php
Part of pfSense
- Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl>
+ Copyright (C) 2009 Seth Mos <seth.mos@xs4all.nl>
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -114,13 +114,13 @@ if ($altq_list_queues[$curif]) {
$altq =& $altq_list_queues[$curif];
switch ($altq->GetBwscale()) {
case "Gb":
- $factor = 1000 * 1000 * 1000;
+ $factor = 1024 * 1024 * 1024;
break;
case "Mb":
- $factor = 1000 * 1000;
+ $factor = 1024 * 1024;
break;
case "Kb":
- $factor = 1000;
+ $factor = 1024;
break;
case "b":
default:
@@ -146,7 +146,7 @@ $rrdcolors = "./themes/{$g['theme']}/rrdcolors.inc.php";
if(file_exists($rrdcolors)) {
include($rrdcolors);
} else {
- // log_error("rrdcolors.inc.php for theme {$g['theme']} does not exist, using defaults!");
+ log_error("rrdcolors.inc.php for theme {$g['theme']} does not exist, using defaults!");
$colortrafficup = "666666";
$colortrafficdown = "990000";
$colorpacketsup = "666666";
@@ -180,69 +180,79 @@ function humantime($timestamp){
$difference = $timestamp;
$periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
$lengths = array("60","60","24","7","4.35","12","10");
- for($j = 0; $difference >= $lengths[$j]; $j++)
+ for($j = 0; $difference >= $lengths[$j]; $j++) {
$difference /= $lengths[$j];
$difference = round($difference);
- if($difference != 1) $periods[$j].= "s";
- $text = "$difference $periods[$j]";
- return $text;
+ if($difference != 1) {
+ $periods[$j].= "s";
+ $text = "$difference $periods[$j]";
+ }
+ }
+ return $text;
}
if((strstr($curdatabase, "-traffic.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for traffic stats */
- $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\
- --start -$seconds -e -$average \\
- --vertical-label \"bits/sec\" \\
- --color SHADEA#eeeeee --color SHADEB#eeeeee \\
- --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\
- --height 200 --width 620 -x \"$scale\" \\
- DEF:$curif-in_bytes=$rrddbpath$curdatabase:in:AVERAGE \\
- DEF:$curif-out_bytes=$rrddbpath$curdatabase:out:AVERAGE \\
- \"CDEF:$curif-in_bits=$curif-in_bytes,8,*\" \\
- \"CDEF:$curif-out_bits=$curif-out_bytes,8,*\" \\
- \"CDEF:$curif-bits_io=$curif-in_bits,$curif-out_bits,+\" \\
- \"CDEF:$curif-out_bits_neg=$curif-out_bits,$multiplier,*\" \\
- \"CDEF:$curif-bytes_in=$curif-in_bytes,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes,IF,$average,*\" \\
- \"CDEF:$curif-bytes_out=$curif-out_bytes,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes,IF,$average,*\" \\
- \"CDEF:$curif-bytes=$curif-bytes_in,$curif-bytes_out,+\" \\
- \"CDEF:$curif-bytes_in_t=$curif-in_bytes,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes,IF,$seconds,*\" \\
- \"CDEF:$curif-bytes_out_t=$curif-out_bytes,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes,IF,$seconds,*\" \\
- \"CDEF:$curif-bytes_t=$curif-bytes_in_t,$curif-bytes_out_t,+\" \\
- AREA:$curif-in_bits#$colortrafficdown:$curif-in \\
- $AREA:$curif-out_bits_neg#$colortrafficup:$curif-out \\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t maximum average current period\\n\"\\
- COMMENT:\"in\t\"\\
- GPRINT:$curif-in_bits:MAX:'%7.2lf %sb/s'\\
- GPRINT:$curif-in_bits:AVERAGE:'%7.2lf %Sb/s'\\
- GPRINT:$curif-in_bits:LAST:'%7.2lf %Sb/s'\\
- GPRINT:$curif-bytes_in_t:AVERAGE:'%7.2lf %sB i'\\
- COMMENT:\"\\n\"\\
- COMMENT:\"out\t\"\\
- GPRINT:$curif-out_bits:MAX:'%7.2lf %sb/s'\\
- GPRINT:$curif-out_bits:AVERAGE:'%7.2lf %Sb/s'\\
- GPRINT:$curif-out_bits:LAST:'%7.2lf %Sb/s'\\
- GPRINT:$curif-bytes_out_t:AVERAGE:'%7.2lf %sB o'\\
- COMMENT:\"\\n\"\\
- COMMENT:\"totals\"\\
- GPRINT:$curif-bits_io:MAX:'%7.2lf %sb/s'\\
- GPRINT:$curif-bits_io:AVERAGE:'%7.2lf %sb/s'\\
- GPRINT:$curif-bits_io:LAST:'%7.2lf %sb/s'\\
- GPRINT:$curif-bytes_t:AVERAGE:'%7.2lf %sB t'\\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
- }
+ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png ";
+ $graphcmd .= "--start -$seconds -e -$average --vertical-label \"bits/sec\" ";
+ $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
+ $graphcmd .= "--title \"`hostname` - $prettydb - $hperiod - $havg average\" ";
+ $graphcmd .= "--height 200 --width 620 -x \"$scale\" ";
+ $graphcmd .= "DEF:$curif-in_bytes_pass=$rrddbpath$curdatabase:inpass:AVERAGE ";
+ $graphcmd .= "DEF:$curif-out_bytes_pass=$rrddbpath$curdatabase:outpass:AVERAGE ";
+ $graphcmd .= "DEF:$curif-in_bytes_block=$rrddbpath$curdatabase:inblock:AVERAGE ";
+ $graphcmd .= "DEF:$curif-out_bytes_block=$rrddbpath$curdatabase:outblock:AVERAGE ";
+ $graphcmd .= "CDEF:\"$curif-in_bits_pass=$curif-in_bytes_pass,8,*\" ";
+ $graphcmd .= "CDEF:\"$curif-out_bits_pass=$curif-out_bytes_pass,8,*\" ";
+ $graphcmd .= "CDEF:\"$curif-in_bits_block=$curif-in_bytes_block,8,*\" ";
+ $graphcmd .= "CDEF:\"$curif-out_bits_block=$curif-out_bytes_block,8,*\" ";
+ $graphcmd .= "CDEF:\"$curif-in_bytes=$curif-in_bytes_pass,$curif-in_bytes_block,+\" ";
+ $graphcmd .= "CDEF:\"$curif-out_bytes=$curif-out_bytes_pass,$curif-out_bytes_block,+\" ";
+ $graphcmd .= "CDEF:\"$curif-in_bits=$curif-in_bits_pass,$curif-in_bits_block,+\" ";
+ $graphcmd .= "CDEF:\"$curif-out_bits=$curif-out_bits_pass,$curif-out_bits_block,+\" ";
+ $graphcmd .= "CDEF:\"$curif-bits_io=$curif-in_bits,$curif-out_bits,+\" ";
+ $graphcmd .= "CDEF:\"$curif-out_bits_neg=$curif-out_bits,$multiplier,*\" ";
+ $graphcmd .= "CDEF:\"$curif-bytes_in=$curif-in_bytes,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes,IF,$average,*\" ";
+ $graphcmd .= "CDEF:\"$curif-bytes_out=$curif-out_bytes,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes,IF,$average,*\" ";
+ $graphcmd .= "CDEF:\"$curif-bytes=$curif-bytes_in,$curif-bytes_out,+\" ";
+ $graphcmd .= "CDEF:\"$curif-bytes_in_t=$curif-in_bytes,0,$speedlimit,LIMIT,UN,0,$curif-in_bytes,IF,$seconds,*\" ";
+ $graphcmd .= "CDEF:\"$curif-bytes_out_t=$curif-out_bytes,0,$speedlimit,LIMIT,UN,0,$curif-out_bytes,IF,$seconds,*\" ";
+ $graphcmd .= "CDEF:\"$curif-bytes_t=$curif-bytes_in_t,$curif-bytes_out_t,+\" ";
+ $graphcmd .= "AREA:\"$curif-in_bits#$colortrafficdown:$curif-in\" ";
+ $graphcmd .= "{$AREA}:\"$curif-out_bits_neg#$colortrafficup:$curif-out\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t maximum average current period\\n\" ";
+ $graphcmd .= "COMMENT:\"in\t\" ";
+ $graphcmd .= "GPRINT:\"$curif-in_bits:MAX:%7.2lf %sb/s\" ";
+ $graphcmd .= "GPRINT:\"$curif-in_bits:AVERAGE:'%7.2lf %Sb/s\" ";
+ $graphcmd .= "GPRINT:\"$curif-in_bits:LAST:%7.2lf %Sb/s\" ";
+ $graphcmd .= "GPRINT:\"$curif-bytes_in_t:AVERAGE:'%7.2lf %sB i\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"out\t\" ";
+ $graphcmd .= "GPRINT:\"$curif-out_bits:MAX:%7.2lf %sb/s\" ";
+ $graphcmd .= "GPRINT:\"$curif-out_bits:AVERAGE:%7.2lf %Sb/s\" ";
+ $graphcmd .= "GPRINT:\"$curif-out_bits:LAST:%7.2lf %Sb/s\" ";
+ $graphcmd .= "GPRINT:\"$curif-bytes_out_t:AVERAGE:%7.2lf %sB o\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"totals\" ";
+ $graphcmd .= "GPRINT:\"$curif-bits_io:MAX:%7.2lf %sb/s\" ";
+ $graphcmd .= "GPRINT:\"$curif-bits_io:AVERAGE:%7.2lf %sb/s\" ";
+ $graphcmd .= "GPRINT:\"$curif-bits_io:LAST:%7.2lf %sb/s\" ";
+ $graphcmd .= "GPRINT:\"$curif-bytes_t:AVERAGE:%7.2lf %sB t\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+}
elseif(strstr($curdatabase, "-throughput.rrd")) {
/* define graphcmd for throughput stats */
/* this gathers all interface statistics, the database does not actually exist */
- $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\
- --start -$seconds -e -$average \\
- --vertical-label \"bits/sec\" \\
- --color SHADEA#eeeeee --color SHADEB#eeeeee \\
- --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\
- --height 200 --width 620 -x \"$scale\" ";
- $vfaces = array ("vlan.?*");
- $ifdescrs = get_interface_list();
+ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png ";
+ $graphcmd .= "--start -$seconds -e -$average ";
+ $graphcmd .= "--vertical-label \"bits/sec\" ";
+ $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
+ $graphcmd .= "--title \"`hostname` - $prettydb - $hperiod - $havg average\" ";
+ $graphcmd .= "--height 200 --width 620 -x \"$scale\" ";
+
+ $iflist = get_configured_interface_list();
$g = 0;
$operand = "";
$comma = "";
@@ -252,29 +262,27 @@ elseif(strstr($curdatabase, "-throughput.rrd")) {
$graphtputbyi = "";
$graphtputbyo = "";
$graphtputbyt = "";
- foreach($ifdescrs as $ifdescr) {
- $ifname = $ifdescr['friendly'];
- $state = $ifdescr['up'];
- /* skip interfaces that do not have a friendly name */
- if ("$ifname" == "") {
- continue;
- }
- /* or are down */
- if (!$state) {
- continue;
- }
+ foreach($iflist as $ifname) {
/* collect all interface stats */
- $graphcmd .= "\"DEF:{$ifname}-in_bytes={$rrddbpath}{$ifname}-traffic.rrd:in:AVERAGE\" ";
- $graphcmd .= "\"DEF:{$ifname}-out_bytes={$rrddbpath}{$ifname}-traffic.rrd:out:AVERAGE\" ";
- $graphcmd .= "\"CDEF:{$ifname}-in_bits={$ifname}-in_bytes,8,*\" ";
- $graphcmd .= "\"CDEF:{$ifname}-out_bits={$ifname}-out_bytes,8,*\" ";
- $graphcmd .= "\"CDEF:{$ifname}-bits_io={$ifname}-in_bits,{$ifname}-out_bits,+\" ";
- $graphcmd .= "\"CDEF:{$ifname}-bytes_in={$ifname}-in_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes,IF,$average,*\" ";
- $graphcmd .= "\"CDEF:{$ifname}-bytes_out={$ifname}-out_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes,IF,$average,*\" ";
- $graphcmd .= "\"CDEF:{$ifname}-bytes={$ifname}-bytes_in,{$ifname}-bytes_out,+\" ";
- $graphcmd .= "\"CDEF:{$ifname}-bytes_in_t={$ifname}-in_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes,IF,$seconds,*\" ";
- $graphcmd .= "\"CDEF:{$ifname}-bytes_out_t={$ifname}-out_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes,IF,$seconds,*\" ";
- $graphcmd .= "\"CDEF:{$ifname}-bytes_t={$ifname}-bytes_in_t,{$ifname}-bytes_out_t,+\" ";
+ $graphcmd .= "DEF:\"{$ifname}-in_bytes_pass={$rrddbpath}{$ifname}-traffic.rrd:inpass:AVERAGE\" ";
+ $graphcmd .= "DEF:\"{$ifname}-out_bytes_pass={$rrddbpath}{$ifname}-traffic.rrd:outpass:AVERAGE\" ";
+ $graphcmd .= "DEF:\"{$ifname}-in_bytes_block={$rrddbpath}{$ifname}-traffic.rrd:inblock:AVERAGE\" ";
+ $graphcmd .= "DEF:\"{$ifname}-out_bytes_block={$rrddbpath}{$ifname}-traffic.rrd:outblock:AVERAGE\" ";
+
+ $graphcmd .= "CDEF:\"{$ifname}-in_bytes={$ifname}-in_bytes_pass,{$ifname}-in_bytes_block,+\" ";
+ $graphcmd .= "CDEF:\"{$ifname}-out_bytes={$ifname}-out_bytes_pass,{$ifname}-out_bytes_block,+\" ";
+
+ $graphcmd .= "CDEF:\"{$ifname}-in_bits={$ifname}-in_bytes,8,*\" ";
+ $graphcmd .= "CDEF:\"{$ifname}-out_bits={$ifname}-out_bytes,8,*\" ";
+ $graphcmd .= "CDEF:\"{$ifname}-bits_io={$ifname}-in_bits,{$ifname}-out_bits,+\" ";
+
+ $graphcmd .= "CDEF:\"{$ifname}-bytes_in={$ifname}-in_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes,IF,$average,*\" ";
+ $graphcmd .= "CDEF:\"{$ifname}-bytes_out={$ifname}-out_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes,IF,$average,*\" ";
+ $graphcmd .= "CDEF:\"{$ifname}-bytes={$ifname}-bytes_in,{$ifname}-bytes_out,+\" ";
+
+ $graphcmd .= "CDEF:\"{$ifname}-bytes_in_t={$ifname}-in_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-in_bytes,IF,$seconds,*\" ";
+ $graphcmd .= "CDEF:\"{$ifname}-bytes_out_t={$ifname}-out_bytes,0,$speedlimit,LIMIT,UN,0,{$ifname}-out_bytes,IF,$seconds,*\" ";
+ $graphcmd .= "CDEF:\"{$ifname}-bytes_t={$ifname}-bytes_in_t,{$ifname}-bytes_out_t,+\" ";
if ($g > 0) {
$operand .= ",+";
$comma = ",";
@@ -287,325 +295,331 @@ elseif(strstr($curdatabase, "-throughput.rrd")) {
$graphtputbyt .= "{$comma}{$ifname}-bytes_t";
$g++;
}
- $graphcmd .= "\"CDEF:tput-in_bits={$graphtputbi}{$operand}\" ";
- $graphcmd .= "\"CDEF:tput-out_bits={$graphtputbo}{$operand}\" ";
- $graphcmd .= "\"CDEF:tput-bits_io={$graphtputbt}{$operand}\" ";
- $graphcmd .= "\"CDEF:tput-out_bits_neg=tput-out_bits,$multiplier,*\" ";
- $graphcmd .= "\"CDEF:tput-bytes_in_t={$graphtputbyi}{$operand}\" ";
- $graphcmd .= "\"CDEF:tput-bytes_out_t={$graphtputbyo}{$operand}\" ";
- $graphcmd .= "\"CDEF:tput-bytes_t={$graphtputbyt}{$operand}\" ";
- $graphcmd .= "AREA:tput-in_bits#$colortrafficdown:in \\
- $AREA:tput-out_bits_neg#$colortrafficup:out \\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t maximum average current period\\n\"\\
- COMMENT:\"in\t\"\\
- GPRINT:tput-in_bits:MAX:'%7.2lf %sb/s'\\
- GPRINT:tput-in_bits:AVERAGE:'%7.2lf %Sb/s'\\
- GPRINT:tput-in_bits:LAST:'%7.2lf %Sb/s'\\
- GPRINT:tput-bytes_in_t:AVERAGE:'%7.2lf %sB i'\\
- COMMENT:\"\\n\"\\
- COMMENT:\"out\t\"\\
- GPRINT:tput-out_bits:MAX:'%7.2lf %sb/s'\\
- GPRINT:tput-out_bits:AVERAGE:'%7.2lf %Sb/s'\\
- GPRINT:tput-out_bits:LAST:'%7.2lf %Sb/s'\\
- GPRINT:tput-bytes_out_t:AVERAGE:'%7.2lf %sB o'\\
- COMMENT:\"\\n\"\\
- COMMENT:\"totals\"\\
- GPRINT:tput-bits_io:MAX:'%7.2lf %sb/s'\\
- GPRINT:tput-bits_io:AVERAGE:'%7.2lf %sb/s'\\
- GPRINT:tput-bits_io:LAST:'%7.2lf %sb/s'\\
- GPRINT:tput-bytes_t:AVERAGE:'%7.2lf %sB t'\\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
- }
+ $graphcmd .= "CDEF:\"tput-in_bits={$graphtputbi}{$operand}\" ";
+ $graphcmd .= "CDEF:\"tput-out_bits={$graphtputbo}{$operand}\" ";
+ $graphcmd .= "CDEF:\"tput-bits_io={$graphtputbt}{$operand}\" ";
+ $graphcmd .= "CDEF:\"tput-out_bits_neg=tput-out_bits,$multiplier,*\" ";
+ $graphcmd .= "CDEF:\"tput-bytes_in_t={$graphtputbyi}{$operand}\" ";
+ $graphcmd .= "CDEF:\"tput-bytes_out_t={$graphtputbyo}{$operand}\" ";
+ $graphcmd .= "CDEF:\"tput-bytes_t={$graphtputbyt}{$operand}\" ";
+ $graphcmd .= "AREA:\"tput-in_bits#$colortrafficdown:in \" ";
+ $graphcmd .= "{$AREA}:\"tput-out_bits_neg#$colortrafficup:out\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t maximum average current period\\n\" ";
+ $graphcmd .= "COMMENT:\"in\t\" ";
+ $graphcmd .= "GPRINT:\"tput-in_bits:MAX:%7.2lf %sb/s\" ";
+ $graphcmd .= "GPRINT:\"tput-in_bits:AVERAGE:%7.2lf %Sb/s\" ";
+ $graphcmd .= "GPRINT:\"tput-in_bits:LAST:%7.2lf %Sb/s\" ";
+ $graphcmd .= "GPRINT:\"tput-bytes_in_t:AVERAGE:%7.2lf %sB i\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"out\t\" ";
+ $graphcmd .= "GPRINT:\"tput-out_bits:MAX:%7.2lf %sb/s\" ";
+ $graphcmd .= "GPRINT:\"tput-out_bits:AVERAGE:%7.2lf %Sb/s\" ";
+ $graphcmd .= "GPRINT:\"tput-out_bits:LAST:%7.2lf %Sb/s\" ";
+ $graphcmd .= "GPRINT:\"tput-bytes_out_t:AVERAGE:%7.2lf %sB o\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"totals\" ";
+ $graphcmd .= "GPRINT:\"tput-bits_io:MAX:%7.2lf %sb/s\" ";
+ $graphcmd .= "GPRINT:\"tput-bits_io:AVERAGE:'%7.2lf %sb/s\" ";
+ $graphcmd .= "GPRINT:\"tput-bits_io:LAST:'%7.2lf %sb/s\" ";
+ $graphcmd .= "GPRINT:\"tput-bytes_t:AVERAGE:'%7.2lf %sB t\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+}
elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for packets stats */
- $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\
- --start -$seconds -e -$average \\
- --vertical-label \"packets/sec\" \\
- --color SHADEA#eeeeee --color SHADEB#eeeeee \\
- --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\
- --height 200 --width 620 -x \"$scale\" \\
- DEF:$curif-in_pps=$rrddbpath$curdatabase:in:AVERAGE \\
- DEF:$curif-out_pps=$rrddbpath$curdatabase:out:AVERAGE \\
- \"CDEF:$curif-out_pps_neg=$curif-out_pps,$multiplier,*\" \\
- \"CDEF:$curif-pps_in=$curif-in_pps,0,12500000,LIMIT,UN,0,$curif-in_pps,IF,$average,*\" \\
- \"CDEF:$curif-pps_out=$curif-out_pps,0,12500000,LIMIT,UN,0,$curif-out_pps,IF,$average,*\" \\
- \"CDEF:$curif-pps_io=$curif-in_pps,$curif-out_pps,+\" \\
- \"CDEF:$curif-pps=$curif-pps_in,$curif-pps_out,+\" \\
- \"CDEF:$curif-pps_in_t=$curif-in_pps,0,12500000,LIMIT,UN,0,$curif-in_pps,IF,$seconds,*\" \\
- \"CDEF:$curif-pps_out_t=$curif-out_pps,0,12500000,LIMIT,UN,0,$curif-out_pps,IF,$seconds,*\" \\
- \"CDEF:$curif-pps_t=$curif-pps_in_t,$curif-pps_out_t,+\" \\
- AREA:$curif-in_pps#$colorpacketsdown:$curif-in \\
- $AREA:$curif-out_pps_neg#$colorpacketsup:$curif-out \\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t maximum average current period\\n\"\\
- COMMENT:\"in\t\"\\
- GPRINT:$curif-in_pps:MAX:'%7.2lf %s pps'\\
- GPRINT:$curif-in_pps:AVERAGE:'%7.2lf %S pps'\\
- GPRINT:$curif-in_pps:LAST:'%7.2lf %S pps'\\
- GPRINT:$curif-pps_in_t:AVERAGE:'%7.2lf %s pkts'\\
- COMMENT:\"\\n\"\\
- COMMENT:\"out\t\"\\
- GPRINT:$curif-out_pps:MAX:'%7.2lf %s pps'\\
- GPRINT:$curif-out_pps:AVERAGE:'%7.2lf %S pps'\\
- GPRINT:$curif-out_pps:LAST:'%7.2lf %S pps'\\
- GPRINT:$curif-pps_out_t:AVERAGE:'%7.2lf %s pkts'\\
- COMMENT:\"\\n\"\\
- COMMENT:\"totals\"\\
- GPRINT:$curif-pps_io:MAX:'%7.2lf %s pps'\\
- GPRINT:$curif-pps_io:AVERAGE:'%7.2lf %s pps'\\
- GPRINT:$curif-pps_io:LAST:'%7.2lf %s pps'\\
- GPRINT:$curif-pps_t:AVERAGE:'%7.2lf %s pkts'\\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
- }
+ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png ";
+ $graphcmd .= "--start -$seconds -e -$average ";
+ $graphcmd .= "--vertical-label \"packets/sec\" ";
+ $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
+ $graphcmd .= "--title \"`hostname` - $prettydb - $hperiod - $havg average\" ";
+ $graphcmd .= "--height 200 --width 620 -x \"$scale\" ";
+ $graphcmd .= "DEF:\"$curif-in_pps_pass=$rrddbpath$curdatabase:inpass:AVERAGE\" ";
+ $graphcmd .= "DEF:\"$curif-out_pps_pass=$rrddbpath$curdatabase:outpass:AVERAGE\" ";
+ $graphcmd .= "DEF:\"$curif-in_pps_block=$rrddbpath$curdatabase:inblock:AVERAGE\" ";
+ $graphcmd .= "DEF:\"$curif-out_pps_block=$rrddbpath$curdatabase:outblock:AVERAGE\" ";
+ $graphcmd .= "CDEF:\"$curif-in_pps=$curif-in_pps_pass,$curif-in_pps_block,*\" ";
+ $graphcmd .= "CDEF:\"$curif-out_pps=$curif-out_pps_pass,$curif-out_pps_block,*\" ";
+ $graphcmd .= "CDEF:\"$curif-out_pps_neg=$curif-out_pps,$multiplier,*\" ";
+ $graphcmd .= "CDEF:\"$curif-pps_in=$curif-in_pps,0,12500000,LIMIT,UN,0,$curif-in_pps,IF,$average,*\" ";
+ $graphcmd .= "CDEF:\"$curif-pps_out=$curif-out_pps,0,12500000,LIMIT,UN,0,$curif-out_pps,IF,$average,*\" ";
+ $graphcmd .= "CDEF:\"$curif-pps_io=$curif-in_pps,$curif-out_pps,+\" ";
+ $graphcmd .= "CDEF:\"$curif-pps=$curif-pps_in,$curif-pps_out,+\" ";
+ $graphcmd .= "CDEF:\"$curif-pps_in_t=$curif-in_pps,0,12500000,LIMIT,UN,0,$curif-in_pps,IF,$seconds,*\" ";
+ $graphcmd .= "CDEF:\"$curif-pps_out_t=$curif-out_pps,0,12500000,LIMIT,UN,0,$curif-out_pps,IF,$seconds,*\" ";
+ $graphcmd .= "CDEF:\"$curif-pps_t=$curif-pps_in_t,$curif-pps_out_t,+\" ";
+ $graphcmd .= "AREA:\"$curif-in_pps#$colorpacketsdown:$curif-in\" ";
+ $graphcmd .= "$AREA:\"$curif-out_pps_neg#$colorpacketsup:$curif-out\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t maximum average current period\\n\" ";
+ $graphcmd .= "COMMENT:\"in\t\" ";
+ $graphcmd .= "GPRINT:\"$curif-in_pps:MAX:%7.2lf %s pps\" ";
+ $graphcmd .= "GPRINT:\"$curif-in_pps:AVERAGE:%7.2lf %S pps\" ";
+ $graphcmd .= "GPRINT:\"$curif-in_pps:LAST:%7.2lf %S pps\" ";
+ $graphcmd .= "GPRINT:\"$curif-pps_in_t:AVERAGE:%7.2lf %s pkts\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"out\t\" ";
+ $graphcmd .= "GPRINT:\"$curif-out_pps:MAX:%7.2lf %s pps\" ";
+ $graphcmd .= "GPRINT:\"$curif-out_pps:AVERAGE:%7.2lf %S pps\" ";
+ $graphcmd .= "GPRINT:\"$curif-out_pps:LAST:%7.2lf %S pps\" ";
+ $graphcmd .= "GPRINT:\"$curif-pps_out_t:AVERAGE:%7.2lf %s pkts\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"totals\" ";
+ $graphcmd .= "GPRINT:\"$curif-pps_io:MAX:%7.2lf %s pps\" ";
+ $graphcmd .= "GPRINT:\"$curif-pps_io:AVERAGE:%7.2lf %s pps\" ";
+ $graphcmd .= "GPRINT:\"$curif-pps_io:LAST:%7.2lf %s pps\" ";
+ $graphcmd .= "GPRINT:\"$curif-pps_t:AVERAGE:%7.2lf %s pkts\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+}
elseif((strstr($curdatabase, "-wireless.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for packets stats */
- $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\
- --start -$seconds -e -$average \\
- --vertical-label \"snr/channel/rate\" \\
- --color SHADEA#eeeeee --color SHADEB#eeeeee \\
- --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\
- --height 200 --width 620 -x \"$scale\" \\
- DEF:$curif-snr=$rrddbpath$curdatabase:snr:AVERAGE \\
- DEF:$curif-rate=$rrddbpath$curdatabase:rate:AVERAGE \\
- DEF:$curif-channel=$rrddbpath$curdatabase:channel:AVERAGE \\
- LINE1:$curif-snr#{$colorwireless[0]}:$curif-snr \\
- LINE1:$curif-rate#{$colorwireless[1]}:$curif-rate \\
- LINE1:$curif-channel#{$colorwireless[2]}:$curif-channel \\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t maximum average current period\\n\"\\
- COMMENT:\"SNR\t\t\"\\
- GPRINT:$curif-snr:MAX:'%7.2lf %s dBi'\\
- GPRINT:$curif-snr:AVERAGE:'%7.2lf %S dBi'\\
- GPRINT:$curif-snr:LAST:'%7.2lf %S dBi'\\
- COMMENT:\"\\n\"\\
- COMMENT:\"RATE\t\t\"\\
- GPRINT:$curif-rate:MAX:'%7.2lf %s Mb '\\
- GPRINT:$curif-rate:AVERAGE:'%7.2lf %S Mb '\\
- GPRINT:$curif-rate:LAST:'%7.2lf %S Mb '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"Channel\t\"\\
- GPRINT:$curif-channel:MAX:'%7.2lf %s '\\
- GPRINT:$curif-channel:AVERAGE:'%7.2lf %s '\\
- GPRINT:$curif-channel:LAST:'%7.2lf %s '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
- }
+ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png ";
+ $graphcmd .= "--start -$seconds -e -$average ";
+ $graphcmd .= "--vertical-label \"snr/channel/rate\" ";
+ $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
+ $graphcmd .= "--title \"`hostname` - $prettydb - $hperiod - $havg average\" ";
+ $graphcmd .= "--height 200 --width 620 -x \"$scale\" ";
+ $graphcmd .= "DEF:\"$curif-snr=$rrddbpath$curdatabase:snr:AVERAGE\" ";
+ $graphcmd .= "DEF:\"$curif-rate=$rrddbpath$curdatabase:rate:AVERAGE\" ";
+ $graphcmd .= "DEF:\"$curif-channel=$rrddbpath$curdatabase:channel:AVERAGE\" ";
+ $graphcmd .= "LINE1:\"$curif-snr#{$colorwireless[0]}:$curif-snr\" ";
+ $graphcmd .= "LINE1:\"$curif-rate#{$colorwireless[1]}:$curif-rate\" ";
+ $graphcmd .= "LINE1:\"$curif-channel#{$colorwireless[2]}:$curif-channel\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t maximum average current period\\n\" ";
+ $graphcmd .= "COMMENT:\"SNR\t\t\" ";
+ $graphcmd .= "GPRINT:\"$curif-snr:MAX:%7.2lf %s dBi\" ";
+ $graphcmd .= "GPRINT:\"$curif-snr:AVERAGE:%7.2lf %S dBi\" ";
+ $graphcmd .= "GPRINT:\"$curif-snr:LAST:%7.2lf %S dBi\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"RATE\t\t\" ";
+ $graphcmd .= "GPRINT:\"$curif-rate:MAX:%7.2lf %s Mb \" ";
+ $graphcmd .= "GPRINT:\"$curif-rate:AVERAGE:%7.2lf %S Mb \" ";
+ $graphcmd .= "GPRINT:\"$curif-rate:LAST:%7.2lf %S Mb \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"Channel\t\" ";
+ $graphcmd .= "GPRINT:\"$curif-channel:MAX:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-channel:AVERAGE:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-channel:LAST:%7.2lf %s \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+}
elseif((strstr($curdatabase, "-states.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for states stats */
- $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\
- --start -$seconds -e -$average \\
- --vertical-label \"states, ip\" \\
- --color SHADEA#eeeeee --color SHADEB#eeeeee \\
- --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\
- --height 200 --width 620 -x \"$scale\" \\
- DEF:$curif-pfrate=$rrddbpath$curdatabase:pfrate:AVERAGE \\
- DEF:$curif-pfstates=$rrddbpath$curdatabase:pfstates:AVERAGE \\
- DEF:$curif-pfnat=$rrddbpath$curdatabase:pfnat:AVERAGE \\
- DEF:$curif-srcip=$rrddbpath$curdatabase:srcip:AVERAGE \\
- DEF:$curif-dstip=$rrddbpath$curdatabase:dstip:AVERAGE \\
- \"CDEF:$curif-pfrate_t=$curif-pfrate,0,1000000,LIMIT,UN,0,$curif-pfrate,IF,$seconds,*\" \\
- LINE1:$curif-pfrate#{$colorstates[0]}:$curif-pfrate \\
- LINE1:$curif-pfstates#{$colorstates[1]}:$curif-pfstates \\
- LINE1:$curif-pfnat#{$colorstates[2]}:$curif-pfnat \\
- LINE1:$curif-srcip#{$colorstates[3]}:$curif-srcip \\
- LINE1:$curif-dstip#{$colorstates[4]}:$curif-dstip \\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t minimum average maximum current period\\n\"\\
- COMMENT:\"state changes\"\\
- GPRINT:$curif-pfrate:MIN:'%7.2lf %s cps'\\
- GPRINT:$curif-pfrate:AVERAGE:'%7.2lf %s cps'\\
- GPRINT:$curif-pfrate:MAX:'%7.2lf %s cps'\\
- GPRINT:$curif-pfrate:LAST:'%7.2lf %S cps'\\
- GPRINT:$curif-pfrate_t:AVERAGE:'%7.2lf %s chg'\\
- COMMENT:\"\\n\"\\
- COMMENT:\"filter states\"\\
- GPRINT:$curif-pfstates:MIN:'%7.2lf %s '\\
- GPRINT:$curif-pfstates:AVERAGE:'%7.2lf %s '\\
- GPRINT:$curif-pfstates:MAX:'%7.2lf %s '\\
- GPRINT:$curif-pfstates:LAST:'%7.2lf %s '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"nat states \"\\
- GPRINT:$curif-pfnat:MIN:'%7.2lf %s '\\
- GPRINT:$curif-pfnat:AVERAGE:'%7.2lf %s '\\
- GPRINT:$curif-pfnat:MAX:'%7.2lf %s '\\
- GPRINT:$curif-pfnat:LAST:'%7.2lf %s '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"Source addr. \"\\
- GPRINT:$curif-srcip:MIN:'%7.2lf %s '\\
- GPRINT:$curif-srcip:AVERAGE:'%7.2lf %s '\\
- GPRINT:$curif-srcip:MAX:'%7.2lf %s '\\
- GPRINT:$curif-srcip:LAST:'%7.2lf %s '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"Dest. addr. \"\\
- GPRINT:$curif-dstip:MIN:'%7.2lf %s '\\
- GPRINT:$curif-dstip:AVERAGE:'%7.2lf %s '\\
- GPRINT:$curif-dstip:MAX:'%7.2lf %s '\\
- GPRINT:$curif-dstip:LAST:'%7.2lf %s '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
- }
+ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png ";
+ $graphcmd .= "--start -$seconds -e -$average ";
+ $graphcmd .= "--vertical-label \"states, ip\" ";
+ $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
+ $graphcmd .= "--title \"`hostname` - $prettydb - $hperiod - $havg average\" ";
+ $graphcmd .= "--height 200 --width 620 -x \"$scale\" ";
+ $graphcmd .= "DEF:\"$curif-pfrate=$rrddbpath$curdatabase:pfrate:AVERAGE\" ";
+ $graphcmd .= "DEF:\"$curif-pfstates=$rrddbpath$curdatabase:pfstates:AVERAGE\" ";
+ $graphcmd .= "DEF:\"$curif-pfnat=$rrddbpath$curdatabase:pfnat:AVERAGE\" ";
+ $graphcmd .= "DEF:\"$curif-srcip=$rrddbpath$curdatabase:srcip:AVERAGE\" ";
+ $graphcmd .= "DEF:\"$curif-dstip=$rrddbpath$curdatabase:dstip:AVERAGE\" ";
+ $graphcmd .= "CDEF:\"$curif-pfrate_t=$curif-pfrate,0,1000000,LIMIT,UN,0,$curif-pfrate,IF,$seconds,*\" ";
+ $graphcmd .= "LINE1:\"$curif-pfrate#{$colorstates[0]}:$curif-pfrate\" ";
+ $graphcmd .= "LINE1:\"$curif-pfstates#{$colorstates[1]}:$curif-pfstates\" ";
+ $graphcmd .= "LINE1:\"$curif-pfnat#{$colorstates[2]}:$curif-pfnat\" ";
+ $graphcmd .= "LINE1:\"$curif-srcip#{$colorstates[3]}:$curif-srcip\" ";
+ $graphcmd .= "LINE1:\"$curif-dstip#{$colorstates[4]}:$curif-dstip\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t minimum average maximum current period\\n\" ";
+ $graphcmd .= "COMMENT:\"state changes\" ";
+ $graphcmd .= "GPRINT:\"$curif-pfrate:MIN:'%7.2lf %s cps\" ";
+ $graphcmd .= "GPRINT:\"$curif-pfrate:AVERAGE:'%7.2lf %s cps\" ";
+ $graphcmd .= "GPRINT:\"$curif-pfrate:MAX:'%7.2lf %s cps\" ";
+ $graphcmd .= "GPRINT:\"$curif-pfrate:LAST:'%7.2lf %S cps\" ";
+ $graphcmd .= "GPRINT:\"$curif-pfrate_t:AVERAGE:'%7.2lf %s chg\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"filter states\" ";
+ $graphcmd .= "GPRINT:\"$curif-pfstates:MIN:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-pfstates:AVERAGE:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-pfstates:MAX:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-pfstates:LAST:'%7.2lf %s \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"nat states \" ";
+ $graphcmd .= "GPRINT:\"$curif-pfnat:MIN:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-pfnat:AVERAGE:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-pfnat:MAX:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-pfnat:LAST:'%7.2lf %s \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"Source addr. \" ";
+ $graphcmd .= "GPRINT:\"$curif-srcip:MIN:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-srcip:AVERAGE:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-srcip:MAX:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-srcip:LAST:'%7.2lf %s \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"Dest. addr. \" ";
+ $graphcmd .= "GPRINT:\"$curif-dstip:MIN:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-dstip:AVERAGE:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-dstip:MAX:'%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"$curif-dstip:LAST:'%7.2lf %s \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+}
elseif((strstr($curdatabase, "-processor.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for processor stats */
- $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\
- --start -$seconds -e -$average \\
- --vertical-label \"utilization, number\" \\
- --color SHADEA#eeeeee --color SHADEB#eeeeee \\
- --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\
- --height 200 --width 620 -x \"$scale\" \\
- DEF:user=$rrddbpath$curdatabase:user:AVERAGE \\
- DEF:nice=$rrddbpath$curdatabase:nice:AVERAGE \\
- DEF:system=$rrddbpath$curdatabase:system:AVERAGE \\
- DEF:interrupt=$rrddbpath$curdatabase:interrupt:AVERAGE \\
- DEF:processes=$rrddbpath$curdatabase:processes:AVERAGE \\
- AREA:user#{$colorprocessor[0]}:user \\
- AREA:nice#{$colorprocessor[1]}:nice:STACK \\
- AREA:system#{$colorprocessor[2]}:system:STACK \\
- AREA:interrupt#{$colorprocessor[3]}:interrupt:STACK \\
- LINE2:processes#{$colorprocessor[4]}:processes \\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t minimum average maximum current\\n\"\\
- COMMENT:\"User util. \"\\
- GPRINT:user:MIN:'%7.2lf %s '\\
- GPRINT:user:AVERAGE:'%7.2lf %s '\\
- GPRINT:user:MAX:'%7.2lf %s '\\
- GPRINT:user:LAST:'%7.2lf %S '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"Nice util. \"\\
- GPRINT:nice:MIN:'%7.2lf %s '\\
- GPRINT:nice:AVERAGE:'%7.2lf %s '\\
- GPRINT:nice:MAX:'%7.2lf %s '\\
- GPRINT:nice:LAST:'%7.2lf %s '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"System util. \"\\
- GPRINT:system:MIN:'%7.2lf %s '\\
- GPRINT:system:AVERAGE:'%7.2lf %s '\\
- GPRINT:system:MAX:'%7.2lf %s '\\
- GPRINT:system:LAST:'%7.2lf %s '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"Interrupt \"\\
- GPRINT:interrupt:MIN:'%7.2lf %s '\\
- GPRINT:interrupt:AVERAGE:'%7.2lf %s '\\
- GPRINT:interrupt:MAX:'%7.2lf %s '\\
- GPRINT:interrupt:LAST:'%7.2lf %s '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"Processes \"\\
- GPRINT:processes:MIN:'%7.2lf %s '\\
- GPRINT:processes:AVERAGE:'%7.2lf %s '\\
- GPRINT:processes:MAX:'%7.2lf %s '\\
- GPRINT:processes:LAST:'%7.2lf %s '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
- }
+ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png ";
+ $graphcmd .= "--start -$seconds -e -$average ";
+ $graphcmd .= "--vertical-label \"utilization, number\" ";
+ $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
+ $graphcmd .= "--title \"`hostname` - $prettydb - $hperiod - $havg average\" ";
+ $graphcmd .= "--height 200 --width 620 -x \"$scale\" ";
+ $graphcmd .= "DEF:\"user=$rrddbpath$curdatabase:user:AVERAGE\" ";
+ $graphcmd .= "DEF:\"nice=$rrddbpath$curdatabase:nice:AVERAGE\" ";
+ $graphcmd .= "DEF:\"system=$rrddbpath$curdatabase:system:AVERAGE\" ";
+ $graphcmd .= "DEF:\"interrupt=$rrddbpath$curdatabase:interrupt:AVERAGE\" ";
+ $graphcmd .= "DEF:\"processes=$rrddbpath$curdatabase:processes:AVERAGE\" ";
+ $graphcmd .= "AREA:\"user#{$colorprocessor[0]}:user\" ";
+ $graphcmd .= "AREA:\"nice#{$colorprocessor[1]}:nice:STACK\" ";
+ $graphcmd .= "AREA:\"system#{$colorprocessor[2]}:system:STACK\" ";
+ $graphcmd .= "AREA:\"interrupt#{$colorprocessor[3]}:interrupt:STACK\" ";
+ $graphcmd .= "LINE2:\"processes#{$colorprocessor[4]}:processes\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t minimum average maximum current\\n\" ";
+ $graphcmd .= "COMMENT:\"User util. \" ";
+ $graphcmd .= "GPRINT:\"user:MIN:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"user:AVERAGE:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"user:MAX:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"user:LAST:%7.2lf %S \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"Nice util. \" ";
+ $graphcmd .= "GPRINT:\"nice:MIN:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"nice:AVERAGE:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"nice:MAX:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"nice:LAST:%7.2lf %s \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"System util. \" ";
+ $graphcmd .= "GPRINT:\"system:MIN:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"system:AVERAGE:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"system:MAX:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"system:LAST:%7.2lf %s \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"Interrupt \" ";
+ $graphcmd .= "GPRINT:\"interrupt:MIN:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"interrupt:AVERAGE:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"interrupt:MAX:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"interrupt:LAST:%7.2lf %s \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"Processes \" ";
+ $graphcmd .= "GPRINT:\"processes:MIN:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"processes:AVERAGE:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"processes:MAX:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"processes:LAST:%7.2lf %s \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+}
elseif((strstr($curdatabase, "-memory.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for memory usage stats */
- $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\
- --start -$seconds -e -$average \\
- --vertical-label \"utilization, percent\" \\
- --color SHADEA#eeeeee --color SHADEB#eeeeee \\
- --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\
- --height 200 --width 620 -x \"$scale\" \\
- DEF:active=$rrddbpath$curdatabase:active:AVERAGE \\
- DEF:inactive=$rrddbpath$curdatabase:inactive:AVERAGE \\
- DEF:free=$rrddbpath$curdatabase:free:AVERAGE \\
- DEF:cache=$rrddbpath$curdatabase:cache:AVERAGE \\
- DEF:wire=$rrddbpath$curdatabase:wire:AVERAGE \\
- LINE2:active#{$colormemory[0]}:active \\
- LINE2:inactive#{$colormemory[1]}:inactive \\
- LINE2:free#{$colormemory[2]}:free \\
- LINE2:cache#{$colormemory[3]}:cache \\
- LINE2:wire#{$colormemory[4]}:wire \\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t minimum average maximum current\\n\"\\
- COMMENT:\"Active. \"\\
- GPRINT:active:MIN:'%7.2lf %s '\\
- GPRINT:active:AVERAGE:'%7.2lf %s '\\
- GPRINT:active:MAX:'%7.2lf %s '\\
- GPRINT:active:LAST:'%7.2lf %S '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"Inactive. \"\\
- GPRINT:inactive:MIN:'%7.2lf %s '\\
- GPRINT:inactive:AVERAGE:'%7.2lf %s '\\
- GPRINT:inactive:MAX:'%7.2lf %s '\\
- GPRINT:inactive:LAST:'%7.2lf %S '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"Free. \"\\
- GPRINT:free:MIN:'%7.2lf %s '\\
- GPRINT:free:AVERAGE:'%7.2lf %s '\\
- GPRINT:free:MAX:'%7.2lf %s '\\
- GPRINT:free:LAST:'%7.2lf %S '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"Cached. \"\\
- GPRINT:cache:MIN:'%7.2lf %s '\\
- GPRINT:cache:AVERAGE:'%7.2lf %s '\\
- GPRINT:cache:MAX:'%7.2lf %s '\\
- GPRINT:cache:LAST:'%7.2lf %S '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"Wired. \"\\
- GPRINT:wire:MIN:'%7.2lf %s '\\
- GPRINT:wire:AVERAGE:'%7.2lf %s '\\
- GPRINT:wire:MAX:'%7.2lf %s '\\
- GPRINT:wire:LAST:'%7.2lf %S '\\
- COMMENT:\"\\n\"\\
- COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
- }
+ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png ";
+ $graphcmd .= "--start -$seconds -e -$average ";
+ $graphcmd .= "--vertical-label \"utilization, percent\" ";
+ $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
+ $graphcmd .= "--title \"`hostname` - $prettydb - $hperiod - $havg average\" ";
+ $graphcmd .= "--height 200 --width 620 -x \"$scale\" ";
+ $graphcmd .= "DEF:\"active=$rrddbpath$curdatabase:active:AVERAGE\" ";
+ $graphcmd .= "DEF:\"inactive=$rrddbpath$curdatabase:inactive:AVERAGE\" ";
+ $graphcmd .= "DEF:\"free=$rrddbpath$curdatabase:free:AVERAGE\" ";
+ $graphcmd .= "DEF:\"cache=$rrddbpath$curdatabase:cache:AVERAGE\" ";
+ $graphcmd .= "DEF:\"wire=$rrddbpath$curdatabase:wire:AVERAGE\" ";
+ $graphcmd .= "LINE2:\"active#{$colormemory[0]}:active\" ";
+ $graphcmd .= "LINE2:\"inactive#{$colormemory[1]}:inactive\" ";
+ $graphcmd .= "LINE2:\"free#{$colormemory[2]}:free\" ";
+ $graphcmd .= "LINE2:\"cache#{$colormemory[3]}:cache\" ";
+ $graphcmd .= "LINE2:\"wire#{$colormemory[4]}:wire\" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t minimum average maximum current\\n\" ";
+ $graphcmd .= "COMMENT:\"Active. \" ";
+ $graphcmd .= "GPRINT:\"active:MIN:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"active:AVERAGE:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"active:MAX:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"active:LAST:%7.2lf %S \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"Inactive. \" ";
+ $graphcmd .= "GPRINT:\"inactive:MIN:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"inactive:AVERAGE:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"inactive:MAX:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"inactive:LAST:%7.2lf %S \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"Free. \" ";
+ $graphcmd .= "GPRINT:\"free:MIN:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"free:AVERAGE:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"free:MAX:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"free:LAST:%7.2lf %S \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"Cached. \" ";
+ $graphcmd .= "GPRINT:\"cache:MIN:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"cache:AVERAGE:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"cache:MAX:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"cache:LAST:%7.2lf %S \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"Wired. \" ";
+ $graphcmd .= "GPRINT:\"wire:MIN:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"wire:AVERAGE:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"wire:MAX:%7.2lf %s \" ";
+ $graphcmd .= "GPRINT:\"wire:LAST:%7.2lf %S \" ";
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+}
elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for queue stats */
- $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\
- --start -$seconds -e -$average \\
- --vertical-label \"bits/sec\" \\
- --color SHADEA#eeeeee --color SHADEB#eeeeee \\
- --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\
- --height 200 --width 620 -x \"$scale\" \\";
- if ($altq)
- $a_queues =& $altq->get_queue_list();
- else
- $a_queues = array();
+ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png ";
+ $graphcmd .= "--start -$seconds -e -$average ";
+ $graphcmd .= "--vertical-label \"bits/sec\" ";
+ $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
+ $graphcmd .= "--title \"`hostname` - $prettydb - $hperiod - $havg average\" ";
+ $graphcmd .= "--height 200 --width 620 -x \"$scale\" ";
+ if ($altq) {
+ $a_queues =& $altq->get_queue_list();
+ } else {
+ $a_queues = array();
$i = 0;
$t = 0;
- foreach ($a_queues as $name => $q) {
- $color = "$colorqueuesup[$t]";
- //if($t > 0) { $stack = ":STACK"; }
- $graphcmd .= "DEF:$name=$rrddbpath$curdatabase:$name:AVERAGE \\
- \"CDEF:$name-bytes_out=$name,0,$speedlimit,LIMIT,UN,0,$name,IF\" \\
- \"CDEF:$name-bits_out=$name-bytes_out,8,*\" \\
- $AREA:$name-bits_out#${color}:$name \\";
- $t++;
- if($t > 7) { $t = 0; }
- }
- $graphcmd .= "COMMENT:\"\\n\" \\";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
}
+ foreach ($a_queues as $name => $q) {
+ $color = "$colorqueuesup[$t]";
+ if($t > 0) { $stack = ":STACK"; }
+ $graphcmd .= "DEF:\"$name=$rrddbpath$curdatabase:$name:AVERAGE\" ";
+ $graphcmd .= "CDEF:\"$name-bytes_out=$name,0,$speedlimit,LIMIT,UN,0,$name,IF\" ";
+ $graphcmd .= "CDEF:\"$name-bits_out=$name-bytes_out,8,*\" ";
+ $graphcmd .= "$AREA:\"$name-bits_out#${color}:$name\" ";
+ $t++;
+ if($t > 7) { $t = 0; }
+ }
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+}
elseif((strstr($curdatabase, "-queuedrops.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* define graphcmd for queuedrop stats */
- $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\
- --start -$seconds -e -$average \\
- --vertical-label \"drops / sec\" \\
- --color SHADEA#eeeeee --color SHADEB#eeeeee \\
- --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\
- --height 200 --width 620 -x \"$scale\" \\";
- if ($altq)
- $a_queues =& $altq->get_queue_list();
- else
- $a_queues = array();
+ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png ";
+ $graphcmd .= "--start -$seconds -e -$average ";
+ $graphcmd .= "--vertical-label \"drops / sec\" ";
+ $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
+ $graphcmd .= "--title \"`hostname` - $prettydb - $hperiod - $havg average\" ";
+ $graphcmd .= "--height 200 --width 620 -x \"$scale\" ";
+ if ($altq) {
+ $a_queues =& $altq->get_queue_list();
+ } else {
+ $a_queues = array();
$i = 0;
$t = 0;
- foreach ($a_queues as $name => $q) {
- $color = "$colorqueuesdropup[$t]";
- //if($t > 0) { $stack = ":STACK"; }
- $graphcmd .= "DEF:$name=$rrddbpath$curdatabase:$name:AVERAGE \\
- \"CDEF:$name-bytes_out=$name,0,$speedlimit,LIMIT,UN,0,$name,IF\" \\
- \"CDEF:$name-bits_out=$name-bytes_out,8,*\" \\
- \"CDEF:$name-bits_out_neg=$name-bits_out,$multiplier,*\" \\
- $AREA:$name-bits_out_neg#${color}:$name \\";
- $t++;
- if($t > 7) { $t = 0; }
- }
- $graphcmd .= "COMMENT:\"\\n\" \\";
- $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
}
+ foreach ($a_queues as $name => $q) {
+ $color = "$colorqueuesdropup[$t]";
+ if($t > 0) { $stack = ":STACK"; }
+ $graphcmd .= "DEF:\"$name=$rrddbpath$curdatabase:$name:AVERAGE\" ";
+ $graphcmd .= "CDEF:\"$name-bytes_out=$name,0,$speedlimit,LIMIT,UN,0,$name,IF\" ";
+ $graphcmd .= "CDEF:\"$name-bits_out=$name-bytes_out,8,*\" ";
+ $graphcmd .= "CDEF:\"$name-bits_out_neg=$name-bits_out,$multiplier,*\" ";
+ $graphcmd .= "$AREA:\"$name-bits_out_neg#${color}:$name\" ";
+ $t++;
+ if($t > 7) { $t = 0; }
+ }
+ $graphcmd .= "COMMENT:\"\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+}
elseif((strstr($curdatabase, "-quality.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* make a link quality graphcmd, we only have WAN for now, others too follow */
$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\
@@ -641,104 +655,101 @@ elseif((strstr($curdatabase, "-quality.rrd")) && (file_exists("$rrddbpath$curdat
AREA:loss10#$colorqualityloss:\"Packet loss\\n\" \\
LINE1:delay#$colorqualityrtt[5]:\"Delay average\\n\" \\
COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
- }
+}
elseif((strstr($curdatabase, "spamd.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
/* graph a spamd statistics graph */
- $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png \\
- --start -$seconds -e -$average \\
- --title \"`hostname` - $prettydb - $hperiod - $havg average\" \\
- --color SHADEA#eeeeee --color SHADEB#eeeeee \\
- --vertical-label=\"Conn / Time, sec.\" \\
- --height 200 --width 620 --no-gridfit \\
- -x \"$scale\" --lower-limit 0 \\
- DEF:consmin=$rrddbpath$curdatabase:conn:MIN \\
- DEF:consavg=$rrddbpath$curdatabase:conn:AVERAGE \\
- DEF:consmax=$rrddbpath$curdatabase:conn:MAX \\
- DEF:timemin=$rrddbpath$curdatabase:time:MIN \\
- DEF:timeavg=$rrddbpath$curdatabase:time:AVERAGE \\
- DEF:timemax=$rrddbpath$curdatabase:time:MAX \\
- \"CDEF:timeminadj=timemin,0,86400,LIMIT,UN,0,timemin,IF\" \\
- \"CDEF:timeavgadj=timeavg,0,86400,LIMIT,UN,0,timeavg,IF\" \\
- \"CDEF:timemaxadj=timemax,0,86400,LIMIT,UN,0,timemax,IF\" \\
- \"CDEF:t1=timeminadj,timeavgadj,+,2,/,timeminadj,-\" \\
- \"CDEF:t2=timeavgadj,timemaxadj,+,2,/,timeminadj,-,t1,-\" \\
- \"CDEF:t3=timemaxadj,timeminadj,-,t1,-,t2,-\" \\
- AREA:timeminadj \\
- AREA:t1#$colorspamdtime[0]::STACK \\
- AREA:t2#$colorspamdtime[1]::STACK \\
- AREA:t3#$colorspamdtime[2]::STACK \\
- LINE2:timeavgadj#$colorspamdtime[3]:\"Time \" \\
- GPRINT:timeminadj:MIN:\"Min\\:%6.2lf\\t\" \\
- GPRINT:timeavgadj:AVERAGE:\"Avg\\:%6.2lf\\t\" \\
- GPRINT:timemaxadj:MAX:\"Max\\:%6.2lf\\n\" \\
- AREA:consmax#$colorspamdconn[0] \\
- AREA:consmin#$colorspamdconn[1] \\
- LINE1:consmin#$colorspamdconn[2] \\
- LINE1:consmax#$colorspamdconn[3] \\
- LINE1:consavg#$colorspamdconn[4]:\"Cons \" \\
- GPRINT:consmin:MIN:\"Min\\:%6.2lf\\t\" \\
- GPRINT:consavg:AVERAGE:\"Avg\\:%6.2lf\\t\" \\
- GPRINT:consmax:MAX:\"Max\\:%6.2lf\\n\" \\
- COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
- }
-else
- {
- $data = false;
- log_error("Sorry we do not have data to graph for $curdatabase");
- }
+ $graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$interval.png ";
+ $graphcmd .= "--start -$seconds -e -$average ";
+ $graphcmd .= "--title \"`hostname` - $prettydb - $hperiod - $havg average\" ";
+ $graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
+ $graphcmd .= "--vertical-label=\"Conn / Time, sec.\" ";
+ $graphcmd .= "--height 200 --width 620 --no-gridfit ";
+ $graphcmd .= "-x \"$scale\" --lower-limit 0 ";
+ $graphcmd .= "DEF:\"consmin=$rrddbpath$curdatabase:conn:MIN\" ";
+ $graphcmd .= "DEF:\"consavg=$rrddbpath$curdatabase:conn:AVERAGE\" ";
+ $graphcmd .= "DEF:\"consmax=$rrddbpath$curdatabase:conn:MAX\" ";
+ $graphcmd .= "DEF:\"timemin=$rrddbpath$curdatabase:time:MIN\" ";
+ $graphcmd .= "DEF:\"timeavg=$rrddbpath$curdatabase:time:AVERAGE\" ";
+ $graphcmd .= "DEF:\"timemax=$rrddbpath$curdatabase:time:MAX\" ";
+ $graphcmd .= "CDEF:\"timeminadj=timemin,0,86400,LIMIT,UN,0,timemin,IF\" ";
+ $graphcmd .= "CDEF:\"timeavgadj=timeavg,0,86400,LIMIT,UN,0,timeavg,IF\" ";
+ $graphcmd .= "CDEF:\"timemaxadj=timemax,0,86400,LIMIT,UN,0,timemax,IF\" ";
+ $graphcmd .= "CDEF:\"t1=timeminadj,timeavgadj,+,2,/,timeminadj,-\" ";
+ $graphcmd .= "CDEF:\"t2=timeavgadj,timemaxadj,+,2,/,timeminadj,-,t1,-\" ";
+ $graphcmd .= "CDEF:\"t3=timemaxadj,timeminadj,-,t1,-,t2,-\" ";
+ $graphcmd .= "AREA:\"timeminadj\" ";
+ $graphcmd .= "AREA:\"t1#$colorspamdtime[0]::STACK\" ";
+ $graphcmd .= "AREA:\"t2#$colorspamdtime[1]::STACK\" ";
+ $graphcmd .= "AREA:\"t3#$colorspamdtime[2]::STACK\" ";
+ $graphcmd .= "LINE2:\"timeavgadj#$colorspamdtime[3]:\"Time \" ";
+ $graphcmd .= "GPRINT:\"timeminadj:MIN:\"Min\\:%6.2lf\\t\" ";
+ $graphcmd .= "GPRINT:\"timeavgadj:AVERAGE:\"Avg\\:%6.2lf\\t\" ";
+ $graphcmd .= "GPRINT:\"timemaxadj:MAX:\"Max\\:%6.2lf\\n\" ";
+ $graphcmd .= "AREA:\"consmax#$colorspamdconn[0]\" ";
+ $graphcmd .= "AREA:\"consmin#$colorspamdconn[1]\" ";
+ $graphcmd .= "LINE1:\"consmin#$colorspamdconn[2]\" ";
+ $graphcmd .= "LINE1:\"consmax#$colorspamdconn[3]\" ";
+ $graphcmd .= "LINE1:\"consavg#$colorspamdconn[4]:\"Cons \" ";
+ $graphcmd .= "GPRINT:\"consmin:MIN:\"Min\\:%6.2lf\\t\" ";
+ $graphcmd .= "GPRINT:\"consavg:AVERAGE:\"Avg\\:%6.2lf\\t\" ";
+ $graphcmd .= "GPRINT:\"consmax:MAX:\"Max\\:%6.2lf\\n\" ";
+ $graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
+} else {
+ $data = false;
+ log_error("Sorry we do not have data to graph for $curdatabase");
+}
- /* check modification time to see if we need to generate image */
- if (file_exists("$rrdtmppath$curdatabase-$interval.png")) {
- if((time() - filemtime("$rrdtmppath$curdatabase-$interval.png")) >= 55 ) {
- if($data)
- exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
- flush();
- usleep(500);
- }
- } else {
+/* check modification time to see if we need to generate image */
+if (file_exists("$rrdtmppath$curdatabase-$interval.png")) {
+ if((time() - filemtime("$rrdtmppath$curdatabase-$interval.png")) >= 55 ) {
if($data)
exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
+ $graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
flush();
usleep(500);
+ }
+} else {
+ if($data)
+ exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
+ $graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
+ flush();
+ usleep(500);
+}
+if(($graphcmdreturn <> 0) || (! $data)) {
+ log_error("Failed to create graph with error code $graphcmdreturn, the error is: $graphcmdoutput");
+ if(strstr($curdatabase, "queues")) {
+ log_error("failed to create graph from $rrddbpath$curdatabase, removing database");
+ exec("/bin/rm -f $rrddbpath$curif$queues");
+ flush();
+ usleep(500);
+ enable_rrd_graphing();
}
- if(!empty($graphcmdoutput)) {
- $graphcmdoutput = implode(" ", $graphcmdoutput);
+ if(strstr($curdatabase, "queuesdrop")) {
+ log_error("failed to create graph from $rrddbpath$curdatabase, removing database");
+ exec("/bin/rm -f $rrddbpath$curdatabase");
+ flush();
+ usleep(500);
+ enable_rrd_graphing();
}
- if(($graphcmdreturn != 0) || (! $data)) {
- log_error("Failed to create graph with error code $graphcmdreturn, the error is: $graphcmdoutput");
- if(strstr($curdatabase, "queues")) {
- log_error("failed to create graph from $rrddbpath$curdatabase, removing database");
- exec("/bin/rm -f $rrddbpath$curif$queues");
- flush();
- usleep(500);
- enable_rrd_graphing();
- }
- if(strstr($curdatabase, "queuesdrop")) {
- log_error("failed to create graph from $rrddbpath$curdatabase, removing database");
- exec("/bin/rm -f $rrddbpath$curdatabase");
- flush();
- usleep(500);
- enable_rrd_graphing();
- }
+ header("Content-type: image/png");
+ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+ header("Cache-Control: no-store, no-cache, must-revalidate");
+ header("Cache-Control: post-check=0, pre-check=0", false);
+ header("Pragma: no-cache");
+ $file= "/usr/local/www/themes/{$g['theme']}/images/misc/rrd_error.png";
+ readfile($file);
+} else {
+ $file = "$rrdtmppath$curdatabase-$interval.png";
+ if(file_exists("$file")) {
header("Content-type: image/png");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
- $file= "/usr/local/www/themes/{$g['theme']}/images/misc/rrd_error.png";
readfile($file);
- } else {
- $file = "$rrdtmppath$curdatabase-$interval.png";
- if(file_exists("$file")) {
- header("Content-type: image/png");
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
- header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
- header("Cache-Control: no-store, no-cache, must-revalidate");
- header("Cache-Control: post-check=0, pre-check=0", false);
- header("Pragma: no-cache");
- readfile($file);
- }
}
+}
?>
OpenPOWER on IntegriCloud