mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-01 16:26:55 +02:00
Cleanup graphs code
git-svn-id: http://www.observium.org/svn/observer/trunk@1898 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -29,5 +29,4 @@ $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/altiga-ssl.rr
|
|||||||
$rrd_options .= " GPRINT:c:AVERAGE:\ \ %7.2lf";
|
$rrd_options .= " GPRINT:c:AVERAGE:\ \ %7.2lf";
|
||||||
$rrd_options .= " GPRINT:c:MAX:\ \ %7.2lf\\\\n";
|
$rrd_options .= " GPRINT:c:MAX:\ \ %7.2lf\\\\n";
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
$sensor = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical as E, devices as D WHERE entPhysical_id = '".mres($_GET['a'])."' and D.device_id = E.device_id"));
|
$sensor = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical as E, devices as D WHERE entPhysical_id = '".mres($_GET['a'])."' and D.device_id = E.device_id"));
|
||||||
|
|
||||||
switch ($sensor['entSensorType']) {
|
switch ($sensor['entSensorType'])
|
||||||
|
{
|
||||||
case 'celsius':
|
case 'celsius':
|
||||||
case 'watts':
|
case 'watts':
|
||||||
case 'voltsDC':
|
case 'voltsDC':
|
||||||
@@ -30,5 +31,4 @@ $rrd_options .= " GPRINT:max:MAX:%5.2lf%s";
|
|||||||
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s";
|
$rrd_options .= " GPRINT:max:MAX:%5.2lf%s";
|
||||||
$rrd_options .= " GPRINT:avg:LAST:%5.2lf%s";
|
$rrd_options .= " GPRINT:avg:LAST:%5.2lf%s";
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -19,10 +19,11 @@ if($_GET['bg']) { $rrd_options .= " -c CANVAS#" . mres($_GET['bg']) . " "; }
|
|||||||
|
|
||||||
#$rrd_options .= " -c BACK#FFFFFF";
|
#$rrd_options .= " -c BACK#FFFFFF";
|
||||||
|
|
||||||
if($height < "99") { $rrd_options .= " --only-graph"; }
|
if ($height < "99") { $rrd_options .= " --only-graph"; } }
|
||||||
|
|
||||||
if ($width <= "300") { $rrd_options .= " --font LEGEND:7:" . $config['mono_font'] . " --font AXIS:6:" . $config['mono_font'];
|
if ($width <= "300") { $rrd_options .= " --font LEGEND:7:" . $config['mono_font'] . " --font AXIS:6:" . $config['mono_font'];
|
||||||
} else { $rrd_options .= " --font LEGEND:8:" . $config['mono_font'] . " --font AXIS:7:" . $config['mono_font']; }
|
else { $rrd_options .= " --font LEGEND:8:" . $config['mono_font'] . " --font AXIS:7:" . $config['mono_font']; }
|
||||||
|
|
||||||
$rrd_options .= " --font-render-mode normal";
|
$rrd_options .= " --font-render-mode normal";
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -27,9 +27,6 @@ if($multiplier)
|
|||||||
$rrd_options .= " DEF:".$in."octets_max=".$rrd_filename_in.":".$rra_in.":MAX";
|
$rrd_options .= " DEF:".$in."octets_max=".$rrd_filename_in.":".$rra_in.":MAX";
|
||||||
}
|
}
|
||||||
|
|
||||||
## No?
|
|
||||||
#print $multiplier;
|
|
||||||
|
|
||||||
$rrd_options .= " CDEF:octets=inoctets,outoctets,+";
|
$rrd_options .= " CDEF:octets=inoctets,outoctets,+";
|
||||||
$rrd_options .= " CDEF:doutoctets=outoctets,-1,*";
|
$rrd_options .= " CDEF:doutoctets=outoctets,-1,*";
|
||||||
$rrd_options .= " CDEF:outbits=outoctets,8,*";
|
$rrd_options .= " CDEF:outbits=outoctets,8,*";
|
||||||
|
|||||||
@@ -25,51 +25,67 @@ $rrd_options .= " CDEF:dout_max=out_max,-1,*";
|
|||||||
$rrd_options .= " CDEF:dout=out,-1,*";
|
$rrd_options .= " CDEF:dout=out,-1,*";
|
||||||
$rrd_options .= " CDEF:both=in,out,+";
|
$rrd_options .= " CDEF:both=in,out,+";
|
||||||
|
|
||||||
if($print_total) {
|
if ($print_total)
|
||||||
|
{
|
||||||
$rrd_options .= " VDEF:totin=in,TOTAL";
|
$rrd_options .= " VDEF:totin=in,TOTAL";
|
||||||
$rrd_options .= " VDEF:totout=out,TOTAL";
|
$rrd_options .= " VDEF:totout=out,TOTAL";
|
||||||
$rrd_options .= " VDEF:tot=both,TOTAL";
|
$rrd_options .= " VDEF:tot=both,TOTAL";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($percentile) {
|
if ($percentile)
|
||||||
|
{
|
||||||
$rrd_options .= " VDEF:percentile_in=in,".$percentile.",PERCENT";
|
$rrd_options .= " VDEF:percentile_in=in,".$percentile.",PERCENT";
|
||||||
$rrd_options .= " VDEF:percentile_out=out,".$percentile.",PERCENT";
|
$rrd_options .= " VDEF:percentile_out=out,".$percentile.",PERCENT";
|
||||||
$rrd_options .= " VDEF:dpercentile_out=dout,".$percentile.",PERCENT";
|
$rrd_options .= " VDEF:dpercentile_out=dout,".$percentile.",PERCENT";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($graph_max) {
|
if ($graph_max)
|
||||||
|
{
|
||||||
$rrd_options .= " AREA:in_max#".$colour_area_in_max.":";
|
$rrd_options .= " AREA:in_max#".$colour_area_in_max.":";
|
||||||
$rrd_options .= " AREA:dout_max#".$colour_area_out_max.":";
|
$rrd_options .= " AREA:dout_max#".$colour_area_out_max.":";
|
||||||
}
|
}
|
||||||
$rrd_options .= " AREA:in#".$colour_area_in.":";
|
$rrd_options .= " AREA:in#".$colour_area_in.":";
|
||||||
$rrd_options .= " COMMENT:'".$unit_text." Now Ave Max";
|
$rrd_options .= " COMMENT:'".$unit_text." Now Ave Max";
|
||||||
if($percentile) {
|
|
||||||
|
if ($percentile)
|
||||||
|
{
|
||||||
$rrd_options .= " ".$percentile."th %";
|
$rrd_options .= " ".$percentile."th %";
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= "\\n'";
|
$rrd_options .= "\\n'";
|
||||||
$rrd_options .= " LINE1.25:in#".$colour_line_in.":'".$in_text."'";
|
$rrd_options .= " LINE1.25:in#".$colour_line_in.":'".$in_text."'";
|
||||||
$rrd_options .= " GPRINT:in:LAST:%6.2lf%s";
|
$rrd_options .= " GPRINT:in:LAST:%6.2lf%s";
|
||||||
$rrd_options .= " GPRINT:in:AVERAGE:%6.2lf%s";
|
$rrd_options .= " GPRINT:in:AVERAGE:%6.2lf%s";
|
||||||
$rrd_options .= " GPRINT:in_max:MAX:%6.2lf%s";
|
$rrd_options .= " GPRINT:in_max:MAX:%6.2lf%s";
|
||||||
if($percentile) {
|
|
||||||
|
if ($percentile)
|
||||||
|
{
|
||||||
$rrd_options .= " GPRINT:percentile_in:%6.2lf%s";
|
$rrd_options .= " GPRINT:percentile_in:%6.2lf%s";
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= " COMMENT:'\\n'";
|
$rrd_options .= " COMMENT:'\\n'";
|
||||||
$rrd_options .= " AREA:dout#".$colour_area_out.":";
|
$rrd_options .= " AREA:dout#".$colour_area_out.":";
|
||||||
$rrd_options .= " LINE1.25:dout#".$colour_line_out.":'".$out_text."'";
|
$rrd_options .= " LINE1.25:dout#".$colour_line_out.":'".$out_text."'";
|
||||||
$rrd_options .= " GPRINT:out:LAST:%6.2lf%s";
|
$rrd_options .= " GPRINT:out:LAST:%6.2lf%s";
|
||||||
$rrd_options .= " GPRINT:out:AVERAGE:%6.2lf%s";
|
$rrd_options .= " GPRINT:out:AVERAGE:%6.2lf%s";
|
||||||
$rrd_options .= " GPRINT:out_max:MAX:%6.2lf%s";
|
$rrd_options .= " GPRINT:out_max:MAX:%6.2lf%s";
|
||||||
if($percentile) {
|
|
||||||
|
if ($percentile)
|
||||||
|
{
|
||||||
$rrd_options .= " GPRINT:percentile_out:%6.2lf%s";
|
$rrd_options .= " GPRINT:percentile_out:%6.2lf%s";
|
||||||
}
|
}
|
||||||
|
|
||||||
$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";
|
||||||
$rrd_options .= " LINE1:dpercentile_out#aa0000";
|
$rrd_options .= " LINE1:dpercentile_out#aa0000";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
include("includes/graphs/common.inc.php");
|
include("includes/graphs/common.inc.php");
|
||||||
|
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach($rrd_filenames as $rrd_filename) {
|
|
||||||
|
foreach ($rrd_filenames as $rrd_filename)
|
||||||
|
{
|
||||||
$rrd_options .= " DEF:inoctets" . $i . "=".$rrd_filename.":".$rra_in.":AVERAGE";
|
$rrd_options .= " DEF:inoctets" . $i . "=".$rrd_filename.":".$rra_in.":AVERAGE";
|
||||||
$rrd_options .= " DEF:outoctets" . $i . "=".$rrd_filename.":".$rra_out.":AVERAGE";
|
$rrd_options .= " DEF:outoctets" . $i . "=".$rrd_filename.":".$rra_out.":AVERAGE";
|
||||||
$in_thing .= $seperator . "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
|
$in_thing .= $seperator . "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
|
||||||
@@ -30,7 +32,8 @@ if($i)
|
|||||||
$rrd_options .= " VDEF:95thout=outbits,95,PERCENT";
|
$rrd_options .= " VDEF:95thout=outbits,95,PERCENT";
|
||||||
$rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT";
|
$rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT";
|
||||||
|
|
||||||
if($legend == 'no' || $legend == '1') {
|
if ($legend == 'no' || $legend == '1')
|
||||||
|
{
|
||||||
$rrd_options .= " AREA:inbits#".$colour_area_in.":";
|
$rrd_options .= " AREA:inbits#".$colour_area_in.":";
|
||||||
$rrd_options .= " LINE1.25:inbits#".$colour_line_in.":";
|
$rrd_options .= " LINE1.25:inbits#".$colour_line_in.":";
|
||||||
$rrd_options .= " AREA:doutbits#".$colour_area_out.":";
|
$rrd_options .= " AREA:doutbits#".$colour_area_out.":";
|
||||||
@@ -49,12 +52,12 @@ if($i)
|
|||||||
$rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
|
$rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
|
||||||
$rrd_options .= " GPRINT:outbits:MAX:%6.2lf%s";
|
$rrd_options .= " GPRINT:outbits:MAX:%6.2lf%s";
|
||||||
$rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n";
|
$rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= " LINE1:95thin#aa0000";
|
$rrd_options .= " LINE1:95thin#aa0000";
|
||||||
$rrd_options .= " LINE1:d95thout#aa0000";
|
$rrd_options .= " LINE1:d95thout#aa0000";
|
||||||
}
|
}
|
||||||
|
|
||||||
#$rrd_options .= " HRULE:0#999999";
|
#$rrd_options .= " HRULE:0#999999";
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -3,13 +3,15 @@
|
|||||||
include("includes/graphs/common.inc.php");
|
include("includes/graphs/common.inc.php");
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$rrd_options .= " COMMENT:' In\: Current Maximum '";
|
$rrd_options .= " COMMENT:' In\: Current Maximum '";
|
||||||
if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; }
|
if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; }
|
||||||
$rrd_options .= " COMMENT:'Out\: Current Maximum'";
|
$rrd_options .= " COMMENT:'Out\: Current Maximum'";
|
||||||
if (!$nototal) { $rrd_options .= " COMMENT:' Total'"; }
|
if (!$nototal) { $rrd_options .= " COMMENT:' Total'"; }
|
||||||
$rrd_options .= " COMMENT:'\\n'";
|
$rrd_options .= " COMMENT:'\\n'";
|
||||||
|
|
||||||
foreach($rrd_list as $rrd) {
|
foreach ($rrd_list as $rrd)
|
||||||
|
{
|
||||||
if (!$config['graph_colours'][$colours_in][$iter] || !$config['graph_colours'][$colours_out][$iter]) { $iter = 0; }
|
if (!$config['graph_colours'][$colours_in][$iter] || !$config['graph_colours'][$colours_out][$iter]) { $iter = 0; }
|
||||||
|
|
||||||
$colour_in=$config['graph_colours'][$colours_in][$iter];
|
$colour_in=$config['graph_colours'][$colours_in][$iter];
|
||||||
@@ -23,25 +25,35 @@
|
|||||||
$rrd_options .= " CDEF:outB".$i."=out".$i.",$multiplier,*";
|
$rrd_options .= " CDEF:outB".$i."=out".$i.",$multiplier,*";
|
||||||
$rrd_options .= " CDEF:outB".$i."_neg=outB".$i.",-1,*";
|
$rrd_options .= " CDEF:outB".$i."_neg=outB".$i.",-1,*";
|
||||||
$rrd_options .= " CDEF:octets".$i."=inB".$i.",outB".$i.",+";
|
$rrd_options .= " CDEF:octets".$i."=inB".$i.",outB".$i.",+";
|
||||||
if(!$args['nototal']) {
|
|
||||||
|
if (!$args['nototal'])
|
||||||
|
{
|
||||||
$rrd_options .= " VDEF:totin".$i."=inB".$i.",TOTAL";
|
$rrd_options .= " VDEF:totin".$i."=inB".$i.",TOTAL";
|
||||||
$rrd_options .= " VDEF:totout".$i."=outB".$i.",TOTAL";
|
$rrd_options .= " VDEF:totout".$i."=outB".$i.",TOTAL";
|
||||||
$rrd_options .= " VDEF:tot".$i."=octets".$i.",TOTAL";
|
$rrd_options .= " VDEF:tot".$i."=octets".$i.",TOTAL";
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= " HRULE:999999999999999#" . $colour_out . ":\\\s:";
|
$rrd_options .= " HRULE:999999999999999#" . $colour_out . ":\\\s:";
|
||||||
|
|
||||||
if ($i) { $stack="STACK"; }
|
if ($i) { $stack="STACK"; }
|
||||||
|
|
||||||
$rrd_options .= " AREA:inB".$i."#" . $colour_in . ":'" . $descr . "':$stack";
|
$rrd_options .= " AREA:inB".$i."#" . $colour_in . ":'" . $descr . "':$stack";
|
||||||
$rrd_optionsb .= " AREA:outB".$i."_neg#" . $colour_out . "::$stack";
|
$rrd_optionsb .= " AREA:outB".$i."_neg#" . $colour_out . "::$stack";
|
||||||
$rrd_options .= " GPRINT:inB".$i.":LAST:%6.2lf%s$units";
|
$rrd_options .= " GPRINT:inB".$i.":LAST:%6.2lf%s$units";
|
||||||
$rrd_options .= " GPRINT:inB".$i.":MAX:%6.2lf%s$units";
|
$rrd_options .= " GPRINT:inB".$i.":MAX:%6.2lf%s$units";
|
||||||
|
|
||||||
if (!$nototal) { $rrd_options .= " GPRINT:totin".$i.":%6.2lf%s$total_units"; }
|
if (!$nototal) { $rrd_options .= " GPRINT:totin".$i.":%6.2lf%s$total_units"; }
|
||||||
|
|
||||||
$rrd_options .= " COMMENT:' '";
|
$rrd_options .= " COMMENT:' '";
|
||||||
$rrd_options .= " GPRINT:outB".$i.":LAST:%6.2lf%s$units";
|
$rrd_options .= " GPRINT:outB".$i.":LAST:%6.2lf%s$units";
|
||||||
$rrd_options .= " GPRINT:outB".$i.":MAX:%6.2lf%s$units";
|
$rrd_options .= " GPRINT:outB".$i.":MAX:%6.2lf%s$units";
|
||||||
|
|
||||||
if (!$nototal) { $rrd_options .= " GPRINT:totout".$i.":%6.2lf%s$total_unit"; }
|
if (!$nototal) { $rrd_options .= " GPRINT:totout".$i.":%6.2lf%s$total_unit"; }
|
||||||
|
|
||||||
$rrd_options .= " COMMENT:\\\\n";
|
$rrd_options .= " COMMENT:\\\\n";
|
||||||
$i++; $iter++;
|
$i++; $iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= $rrd_optionsb;
|
$rrd_options .= $rrd_optionsb;
|
||||||
$rrd_options .= " HRULE:0#999999";
|
$rrd_options .= " HRULE:0#999999";
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
$rrd_options .= " COMMENT:'".$unit_text." Cur Min Max Avg\\n'";
|
$rrd_options .= " COMMENT:'".$unit_text." Cur Min Max Avg\\n'";
|
||||||
|
|
||||||
|
|
||||||
foreach($rrd_list as $rrd) {
|
foreach ($rrd_list as $rrd)
|
||||||
|
{
|
||||||
if (!$config['graph_colours'][$colours][$iter]) { $iter = 0; }
|
if (!$config['graph_colours'][$colours][$iter]) { $iter = 0; }
|
||||||
|
|
||||||
$colour=$config['graph_colours'][$colours][$iter];
|
$colour=$config['graph_colours'][$colours][$iter];
|
||||||
@@ -27,7 +28,9 @@
|
|||||||
$rrd_options .= " DEF:".$id."=$filename:$rra:AVERAGE";
|
$rrd_options .= " DEF:".$id."=$filename:$rra:AVERAGE";
|
||||||
$rrd_options .= " DEF:".$id."min=$filename:$rra:MIN";
|
$rrd_options .= " DEF:".$id."min=$filename:$rra:MIN";
|
||||||
$rrd_options .= " DEF:".$id."max=$filename:$rra:MAX";
|
$rrd_options .= " DEF:".$id."max=$filename:$rra:MAX";
|
||||||
if($rrd['invert'] == "1") {
|
|
||||||
|
if ($rrd['invert'] == "1")
|
||||||
|
{
|
||||||
$rrd_options .= " CDEF:".$id."graph=".$id.",-1,*";
|
$rrd_options .= " CDEF:".$id."graph=".$id.",-1,*";
|
||||||
$rrd_options .= " LINE1.25:".$id."graph#".$colour.":'$descr'";
|
$rrd_options .= " LINE1.25:".$id."graph#".$colour.":'$descr'";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -8,20 +8,25 @@
|
|||||||
$rrd_options .= " COMMENT:'\\n'";
|
$rrd_options .= " COMMENT:'\\n'";
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach($rrd_list as $rrd) {
|
foreach ($rrd_list as $rrd)
|
||||||
|
{
|
||||||
if (!$config['graph_colours'][$colours][$iter]) { $iter = 0; }
|
if (!$config['graph_colours'][$colours][$iter]) { $iter = 0; }
|
||||||
$colour = $config['graph_colours'][$colours][$iter];
|
$colour = $config['graph_colours'][$colours][$iter];
|
||||||
$rrd_options .= " DEF:".$rrd['rra'].$i."=".$rrd['filename'].":".$rrd['rra'].":AVERAGE ";
|
$rrd_options .= " DEF:".$rrd['rra'].$i."=".$rrd['filename'].":".$rrd['rra'].":AVERAGE ";
|
||||||
$rrd_options .= " DEF:".$rrd['rra'].$i."max=".$rrd['filename'].":".$rrd['rra'].":MAX ";
|
$rrd_options .= " DEF:".$rrd['rra'].$i."max=".$rrd['filename'].":".$rrd['rra'].":MAX ";
|
||||||
|
|
||||||
if(!$args['nototal']) {
|
if (!$args['nototal'])
|
||||||
|
{
|
||||||
$rrd_options .= " VDEF:tot".$rrd['rra'].$i."=".$rrd['rra'].$i.",TOTAL";
|
$rrd_options .= " VDEF:tot".$rrd['rra'].$i."=".$rrd['rra'].$i.",TOTAL";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($i) { $stack="STACK"; }
|
if ($i) { $stack="STACK"; }
|
||||||
$rrd_options .= " AREA:".$rrd['rra'].$i."#" . $colour . ":'" . substr(str_pad($rrd['descr'], 18),0,18) . "':$stack";
|
$rrd_options .= " AREA:".$rrd['rra'].$i."#" . $colour . ":'" . substr(str_pad($rrd['descr'], 18),0,18) . "':$stack";
|
||||||
$rrd_options .= " GPRINT:".$rrd['rra'].$i.":LAST:%6.2lf%s$units";
|
$rrd_options .= " GPRINT:".$rrd['rra'].$i.":LAST:%6.2lf%s$units";
|
||||||
$rrd_options .= " GPRINT:".$rrd['rra'].$i."max:MAX:%6.2lf%s$units";
|
$rrd_options .= " GPRINT:".$rrd['rra'].$i."max:MAX:%6.2lf%s$units";
|
||||||
|
|
||||||
if (!$nototal) { $rrd_options .= " GPRINT:tot".$rrd['rra'].$i.":%6.2lf%s$total_units"; }
|
if (!$nototal) { $rrd_options .= " GPRINT:tot".$rrd['rra'].$i.":%6.2lf%s$total_units"; }
|
||||||
|
|
||||||
$rrd_options .= " COMMENT:'\\n'";
|
$rrd_options .= " COMMENT:'\\n'";
|
||||||
$i++; $iter++;
|
$i++; $iter++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,36 +11,49 @@ $line_text = str_pad(truncate($line_text,12,''),12);
|
|||||||
$rrd_options .= " DEF:".$rra."=".$rrd_filename.":".$rra.":AVERAGE";
|
$rrd_options .= " DEF:".$rra."=".$rrd_filename.":".$rra.":AVERAGE";
|
||||||
$rrd_options .= " DEF:".$rra."_max=".$rrd_filename.":".$rra.":MAX";
|
$rrd_options .= " DEF:".$rra."_max=".$rrd_filename.":".$rra.":MAX";
|
||||||
|
|
||||||
if($print_total) {
|
if ($print_total)
|
||||||
|
{
|
||||||
$rrd_options .= " VDEF:".$rra."_total=rra,TOTAL";
|
$rrd_options .= " VDEF:".$rra."_total=rra,TOTAL";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($percentile) {
|
if ($percentile)
|
||||||
|
{
|
||||||
$rrd_options .= " VDEF:".$rra."_percentile=".$rra.",".$percentile.",PERCENT";
|
$rrd_options .= " VDEF:".$rra."_percentile=".$rra.",".$percentile.",PERCENT";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($graph_max) {
|
if ($graph_max)
|
||||||
|
{
|
||||||
$rrd_options .= " AREA:".$rra."_max#".$colour_area_max.":";
|
$rrd_options .= " AREA:".$rra."_max#".$colour_area_max.":";
|
||||||
}
|
}
|
||||||
$rrd_options .= " AREA:".$rra."#".$colour_area.":";
|
$rrd_options .= " AREA:".$rra."#".$colour_area.":";
|
||||||
$rrd_options .= " COMMENT:'".$unit_text."Now Ave Max";
|
$rrd_options .= " COMMENT:'".$unit_text."Now Ave Max";
|
||||||
if($percentile) {
|
|
||||||
|
if ($percentile)
|
||||||
|
{
|
||||||
$rrd_options .= " ".$percentile."th %";
|
$rrd_options .= " ".$percentile."th %";
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= "\\n'";
|
$rrd_options .= "\\n'";
|
||||||
$rrd_options .= " LINE1.25:".$rra."#".$colour_line.":'".$line_text."'";
|
$rrd_options .= " LINE1.25:".$rra."#".$colour_line.":'".$line_text."'";
|
||||||
$rrd_options .= " GPRINT:".$rra.":LAST:%6.2lf%s";
|
$rrd_options .= " GPRINT:".$rra.":LAST:%6.2lf%s";
|
||||||
$rrd_options .= " GPRINT:".$rra.":AVERAGE:%6.2lf%s";
|
$rrd_options .= " GPRINT:".$rra.":AVERAGE:%6.2lf%s";
|
||||||
$rrd_options .= " GPRINT:".$rra."_max:MAX:%6.2lf%s";
|
$rrd_options .= " GPRINT:".$rra."_max:MAX:%6.2lf%s";
|
||||||
if($percentile) {
|
|
||||||
|
if ($percentile)
|
||||||
|
{
|
||||||
$rrd_options .= " GPRINT:".$rra."_percentile:%6.2lf%s";
|
$rrd_options .= " GPRINT:".$rra."_percentile:%6.2lf%s";
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= "\\\\n";
|
$rrd_options .= "\\\\n";
|
||||||
$rrd_options .= " COMMENT:\\\\n";
|
$rrd_options .= " COMMENT:\\\\n";
|
||||||
if($print_total) {
|
|
||||||
|
if ($print_total)
|
||||||
|
{
|
||||||
$rrd_options .= " GPRINT:".$rra."_tot:Total\ %6.2lf%s\)\\\\l";
|
$rrd_options .= " GPRINT:".$rra."_tot:Total\ %6.2lf%s\)\\\\l";
|
||||||
}
|
}
|
||||||
if($percentile) {
|
|
||||||
|
if ($percentile)
|
||||||
|
{
|
||||||
$rrd_options .= " LINE1:".$rra."_percentile#aa0000";
|
$rrd_options .= " LINE1:".$rra."_percentile#aa0000";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,8 +79,9 @@ else
|
|||||||
|
|
||||||
function graph_error($string)
|
function graph_error($string)
|
||||||
{
|
{
|
||||||
global $width, $height;
|
global $width, $height, $debug;
|
||||||
header('Content-type: image/png');
|
|
||||||
|
if (!$debug) { header('Content-type: image/png'); }
|
||||||
if ($height > "99") { $width +=75; }
|
if ($height > "99") { $width +=75; }
|
||||||
$im = imagecreate($width, $height);
|
$im = imagecreate($width, $height);
|
||||||
$orange = imagecolorallocate($im, 255, 225, 225);
|
$orange = imagecolorallocate($im, 255, 225, 225);
|
||||||
@@ -115,7 +116,7 @@ if (!$auth)
|
|||||||
if ($config['rrdcached']) { $rrd_switches = " --daemon ".$config['rrdcached'] . " "; }
|
if ($config['rrdcached']) { $rrd_switches = " --daemon ".$config['rrdcached'] . " "; }
|
||||||
$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches;
|
$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches;
|
||||||
$woo = shell_exec($rrd_cmd);
|
$woo = shell_exec($rrd_cmd);
|
||||||
if ($_GET['debug']) { echo("<pre>".$rrd_cmd."</pre>"); }
|
if ($debug) { echo("<pre>".$rrd_cmd."</pre>"); }
|
||||||
if (is_file($graphfile))
|
if (is_file($graphfile))
|
||||||
{
|
{
|
||||||
header('Content-type: image/png');
|
header('Content-type: image/png');
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ $rrd_list[2]['filename'] = $file;
|
|||||||
$rrd_list[2]['descr'] = "Failed";
|
$rrd_list[2]['descr'] = "Failed";
|
||||||
$rrd_list[2]['rra'] = "failed";
|
$rrd_list[2]['rra'] = "failed";
|
||||||
|
|
||||||
|
|
||||||
if ($_GET['debug']) { print_r($rrd_list); }
|
if ($_GET['debug']) { print_r($rrd_list); }
|
||||||
|
|
||||||
$colours = "mixed";
|
$colours = "mixed";
|
||||||
@@ -26,9 +25,6 @@ $nototal = 1;
|
|||||||
$unit_text = "Sessions";
|
$unit_text = "Sessions";
|
||||||
$scale_min = "0";
|
$scale_min = "0";
|
||||||
|
|
||||||
|
|
||||||
include ("generic_multi_simplex_seperated.inc.php");
|
include ("generic_multi_simplex_seperated.inc.php");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user