pass arguments to rrdtool via stdin instead of commandline (experimental, please find regressions if any ;))

git-svn-id: http://www.observium.org/svn/observer/trunk@1107 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-06-08 18:22:00 +00:00
parent 44ba5de799
commit a8babb6d0d
3 changed files with 11 additions and 9 deletions

View File

@@ -57,8 +57,10 @@ if($_GET['debug']) {
} }
if($rrd_options) { if($rrd_options) {
if($_GET['debug']) { echo("<pre>".$config['rrdtool'] . " graph $graphfile $rrd_options"); } if($_GET['debug']) { echo("<pre>".$config['rrdtool'] . " graph $graphfile $rrd_options\n\n"); }
$thing = shell_exec($config['rrdtool'] . " graph $graphfile $rrd_options"); $thing = popen($config['rrdtool'] . " -",'w');
fputs($thing, "graph $graphfile $rrd_options");
pclose($thing);
if(is_file($graphfile)) { if(is_file($graphfile)) {
header('Content-type: image/png'); header('Content-type: image/png');
$fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd); $fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd);

View File

@@ -31,7 +31,7 @@ $rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT";
$rrd_options .= " AREA:inbits_max#aDEB7B:"; $rrd_options .= " AREA:inbits_max#aDEB7B:";
$rrd_options .= " AREA:inbits#CDEB8B:"; $rrd_options .= " AREA:inbits#CDEB8B:";
$rrd_options .= " COMMENT:'BPS Now Ave Max 95th %\\n'"; $rrd_options .= " COMMENT:'BPS Now Ave Max 95th %\\n'";
$rrd_options .= " LINE1.25:inbits#006600:In\ "; $rrd_options .= " LINE1.25:inbits#006600:'In '";
$rrd_options .= " GPRINT:inbits:LAST:%6.2lf%s"; $rrd_options .= " GPRINT:inbits:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:inbits:AVERAGE:%6.2lf%s"; $rrd_options .= " GPRINT:inbits:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:inbits_max:MAX:%6.2lf%s"; $rrd_options .= " GPRINT:inbits_max:MAX:%6.2lf%s";
@@ -43,9 +43,9 @@ $rrd_options .= " GPRINT:outbits:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s"; $rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:outbits_max:MAX:%6.2lf%s"; $rrd_options .= " GPRINT:outbits_max:MAX:%6.2lf%s";
$rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n"; $rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n";
$rrd_options .= " GPRINT:tot:Total\ %6.2lf%s"; $rrd_options .= " GPRINT:tot:'Total %6.2lf%s'";
$rrd_options .= " GPRINT:totin:\(In\ %6.2lf%s"; $rrd_options .= " GPRINT:totin:'(In %6.2lf%s'";
$rrd_options .= " GPRINT:totout:Out\ %6.2lf%s\)\\\\l"; $rrd_options .= " GPRINT:totout:'Out %6.2lf%s)\\\\l'";
$rrd_options .= " LINE1:95thin#aa0000"; $rrd_options .= " LINE1:95thin#aa0000";
$rrd_options .= " LINE1:d95thout#aa0000"; $rrd_options .= " LINE1:d95thout#aa0000";

View File

@@ -57,9 +57,9 @@ if($percentile) {
} }
$rrd_options .= " COMMENT:\\\\n"; $rrd_options .= " COMMENT:\\\\n";
if($print_total) { if($print_total) {
$rrd_options .= " GPRINT:tot:Total\ %6.2lf%s"; $rrd_options .= " GPRINT:tot:'Total\ %6.2lf%s'";
$rrd_options .= " GPRINT:totin:\(In\ %6.2lf%s"; $rrd_options .= " GPRINT:totin:'(In %6.2lf%s'";
$rrd_options .= " GPRINT:totout:Out\ %6.2lf%s\)\\\\l"; $rrd_options .= " GPRINT:totout:'Out %6.2lf%s)\\\\l'";
} }
if($percentile) { if($percentile) {
$rrd_options .= " LINE1:percentile_in#aa0000"; $rrd_options .= " LINE1:percentile_in#aa0000";