From 6708b67694b18c435881896c549ee3167c2f1598 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Thu, 17 Mar 2011 10:57:51 +0000 Subject: [PATCH] Cleanup graphs code git-svn-id: http://www.observium.org/svn/observer/trunk@1898 61d68cd4-352d-0410-923a-c4978735b2b8 --- .../graphs/XXX_device_memory_windows.inc.php | 2 +- .../graphs/altiga_ssl_sessions.inc.php | 45 +++++----- html/includes/graphs/atmvp/auth.inc.php | 4 +- html/includes/graphs/bgp/auth.inc.php | 4 +- .../graphs/cisco_entity_sensor.inc.php | 18 ++-- html/includes/graphs/common.inc.php | 31 +++---- html/includes/graphs/generic_bits.inc.php | 11 +-- html/includes/graphs/generic_bytes.inc.php | 8 +- html/includes/graphs/generic_duplex.inc.php | 40 ++++++--- .../graphs/generic_multi_bits.inc.php | 51 ++++++----- .../generic_multi_bits_separated.inc.php | 90 +++++++++++-------- .../graphs/generic_multi_line.inc.php | 61 +++++++------ .../graphs/generic_multi_seperated.inc.php | 30 +++---- .../generic_multi_simplex_seperated.inc.php | 49 +++++----- html/includes/graphs/generic_simplex.inc.php | 29 ++++-- html/includes/graphs/graph.inc.php | 11 +-- .../includes/graphs/screenos_sessions.inc.php | 8 +- 17 files changed, 269 insertions(+), 223 deletions(-) diff --git a/html/includes/graphs/XXX_device_memory_windows.inc.php b/html/includes/graphs/XXX_device_memory_windows.inc.php index d0650b5853..ad246586d7 100644 --- a/html/includes/graphs/XXX_device_memory_windows.inc.php +++ b/html/includes/graphs/XXX_device_memory_windows.inc.php @@ -62,4 +62,4 @@ $rrd_options .= " GPRINT:usedswap:MAX:%7.2lf%sB\\\\n"; $rrd_options .= " LINE1:totalreal#050505:total"; $rrd_options .= " GPRINT:totalreal:AVERAGE:\ \ %7.2lf%sB"; -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/altiga_ssl_sessions.inc.php b/html/includes/graphs/altiga_ssl_sessions.inc.php index d7f630943e..01e3e66702 100644 --- a/html/includes/graphs/altiga_ssl_sessions.inc.php +++ b/html/includes/graphs/altiga_ssl_sessions.inc.php @@ -7,27 +7,26 @@ $device = device_by_id_cache($id); $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/altiga-ssl.rrd.rrd"; - $rrd_options .= " DEF:TotalSessions=$rrd_filename:TotalSessions:AVERAGE"; - $rrd_options .= " DEF:ActiveSessions=$rrd_filename:ActiveSessions:AVERAGE"; - $rrd_options .= " DEF:MaxSessions=$rrd_filename:MaxSessions:AVERAGE"; - $rrd_options .= " CDEF:a=1min,100,/"; - $rrd_options .= " CDEF:b=5min,100,/"; - $rrd_options .= " CDEF:c=15min,100,/"; - $rrd_options .= " CDEF:cdefd=a,b,c,+,+"; - $rrd_options .= " COMMENT:Load\ Average\ \ Current\ \ \ \ Average\ \ \ \ Maximum\\\\n"; - $rrd_options .= " AREA:a#ffeeaa:1\ Min:"; - $rrd_options .= " LINE1:a#c5aa00:"; - $rrd_options .= " GPRINT:a:LAST:\ \ \ \ %7.2lf"; - $rrd_options .= " GPRINT:a:AVERAGE:\ \ %7.2lf"; - $rrd_options .= " GPRINT:a:MAX:\ \ %7.2lf\\\\n"; - $rrd_options .= " LINE1.25:b#ea8f00:5\ Min:"; - $rrd_options .= " GPRINT:b:LAST:\ \ \ \ %7.2lf"; - $rrd_options .= " GPRINT:b:AVERAGE:\ \ %7.2lf"; - $rrd_options .= " GPRINT:b:MAX:\ \ %7.2lf\\\\n"; - $rrd_options .= " LINE1.25:c#cc0000:15\ Min"; - $rrd_options .= " GPRINT:c:LAST:\ \ \ %7.2lf"; - $rrd_options .= " GPRINT:c:AVERAGE:\ \ %7.2lf"; - $rrd_options .= " GPRINT:c:MAX:\ \ %7.2lf\\\\n"; +$rrd_options .= " DEF:TotalSessions=$rrd_filename:TotalSessions:AVERAGE"; +$rrd_options .= " DEF:ActiveSessions=$rrd_filename:ActiveSessions:AVERAGE"; +$rrd_options .= " DEF:MaxSessions=$rrd_filename:MaxSessions:AVERAGE"; +$rrd_options .= " CDEF:a=1min,100,/"; +$rrd_options .= " CDEF:b=5min,100,/"; +$rrd_options .= " CDEF:c=15min,100,/"; +$rrd_options .= " CDEF:cdefd=a,b,c,+,+"; +$rrd_options .= " COMMENT:Load\ Average\ \ Current\ \ \ \ Average\ \ \ \ Maximum\\\\n"; +$rrd_options .= " AREA:a#ffeeaa:1\ Min:"; +$rrd_options .= " LINE1:a#c5aa00:"; +$rrd_options .= " GPRINT:a:LAST:\ \ \ \ %7.2lf"; +$rrd_options .= " GPRINT:a:AVERAGE:\ \ %7.2lf"; +$rrd_options .= " GPRINT:a:MAX:\ \ %7.2lf\\\\n"; +$rrd_options .= " LINE1.25:b#ea8f00:5\ Min:"; +$rrd_options .= " GPRINT:b:LAST:\ \ \ \ %7.2lf"; +$rrd_options .= " GPRINT:b:AVERAGE:\ \ %7.2lf"; +$rrd_options .= " GPRINT:b:MAX:\ \ %7.2lf\\\\n"; +$rrd_options .= " LINE1.25:c#cc0000:15\ Min"; +$rrd_options .= " GPRINT:c:LAST:\ \ \ %7.2lf"; +$rrd_options .= " GPRINT:c:AVERAGE:\ \ %7.2lf"; +$rrd_options .= " GPRINT:c:MAX:\ \ %7.2lf\\\\n"; - -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/atmvp/auth.inc.php b/html/includes/graphs/atmvp/auth.inc.php index cfdb6d445b..b3d230aef4 100644 --- a/html/includes/graphs/atmvp/auth.inc.php +++ b/html/includes/graphs/atmvp/auth.inc.php @@ -1,7 +1,7 @@ +?> \ No newline at end of file diff --git a/html/includes/graphs/common.inc.php b/html/includes/graphs/common.inc.php index 4121a405bd..21fac3c01a 100644 --- a/html/includes/graphs/common.inc.php +++ b/html/includes/graphs/common.inc.php @@ -1,28 +1,29 @@ +?> \ No newline at end of file diff --git a/html/includes/graphs/generic_bits.inc.php b/html/includes/graphs/generic_bits.inc.php index b2dcdf5cd5..dcbbb6afdf 100644 --- a/html/includes/graphs/generic_bits.inc.php +++ b/html/includes/graphs/generic_bits.inc.php @@ -5,12 +5,12 @@ include("includes/graphs/common.inc.php"); -if($rrd_filename) { $rrd_filename_out = $rrd_filename; $rrd_filename_in = $rrd_filename; } +if ($rrd_filename) { $rrd_filename_out = $rrd_filename; $rrd_filename_in = $rrd_filename; } -if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } +if ($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } -if($multiplier) +if ($multiplier) { $rrd_options .= " DEF:p".$out."octets=".$rrd_filename_out.":".$rra_out.":AVERAGE"; $rrd_options .= " DEF:p".$in."octets=".$rrd_filename_in.":".$rra_in.":AVERAGE"; @@ -27,9 +27,6 @@ if($multiplier) $rrd_options .= " DEF:".$in."octets_max=".$rrd_filename_in.":".$rra_in.":MAX"; } -## No? -#print $multiplier; - $rrd_options .= " CDEF:octets=inoctets,outoctets,+"; $rrd_options .= " CDEF:doutoctets=outoctets,-1,*"; $rrd_options .= " CDEF:outbits=outoctets,8,*"; @@ -70,4 +67,4 @@ $rrd_options .= " GPRINT:totout:'Out %6.2lf%s)\\\\l'"; $rrd_options .= " LINE1:95thin#aa0000"; $rrd_options .= " LINE1:d95thout#aa0000"; -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/generic_bytes.inc.php b/html/includes/graphs/generic_bytes.inc.php index 920c28d9ae..d518101218 100644 --- a/html/includes/graphs/generic_bytes.inc.php +++ b/html/includes/graphs/generic_bytes.inc.php @@ -5,12 +5,12 @@ include("includes/graphs/common.inc.php"); -if($rrd_filename) { $rrd_filename_out = $rrd_filename; $rrd_filename_in = $rrd_filename; } +if ($rrd_filename) { $rrd_filename_out = $rrd_filename; $rrd_filename_in = $rrd_filename; } -if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } +if ($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } -if($multiplier) +if ($multiplier) { $rrd_options .= " DEF:p".$out."octets=".$rrd_filename_out.":".$rra_out.":AVERAGE"; $rrd_options .= " DEF:p".$in."octets=".$rrd_filename_in.":".$rra_in.":AVERAGE"; @@ -60,4 +60,4 @@ $rrd_options .= " GPRINT:totout:'Out %6.2lf%s)\\\\l'"; #$rrd_options .= " LINE1:95thin#aa0000"; #$rrd_options .= " LINE1:d95thout#aa0000"; -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/generic_duplex.inc.php b/html/includes/graphs/generic_duplex.inc.php index 1d28f526f3..f9cb07e253 100644 --- a/html/includes/graphs/generic_duplex.inc.php +++ b/html/includes/graphs/generic_duplex.inc.php @@ -7,10 +7,10 @@ include("includes/graphs/common.inc.php"); $length = "10"; -if(!isset($percentile)) { $length += "2"; } +if (!isset($percentile)) { $length += "2"; } -if(!isset($out_text)) { $out_text = "Out"; } -if(!isset($in_text)) { $in_text = "In"; } +if (!isset($out_text)) { $out_text = "Out"; } +if (!isset($in_text)) { $in_text = "In"; } $unit_text = str_pad(truncate($unit_text,$length),$length); $in_text = str_pad(truncate($in_text,$length),$length); @@ -25,53 +25,69 @@ $rrd_options .= " CDEF:dout_max=out_max,-1,*"; $rrd_options .= " CDEF:dout=out,-1,*"; $rrd_options .= " CDEF:both=in,out,+"; -if($print_total) { +if ($print_total) +{ $rrd_options .= " VDEF:totin=in,TOTAL"; $rrd_options .= " VDEF:totout=out,TOTAL"; $rrd_options .= " VDEF:tot=both,TOTAL"; } -if($percentile) { +if ($percentile) +{ $rrd_options .= " VDEF:percentile_in=in,".$percentile.",PERCENT"; $rrd_options .= " VDEF:percentile_out=out,".$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:dout_max#".$colour_area_out_max.":"; } $rrd_options .= " AREA:in#".$colour_area_in.":"; $rrd_options .= " COMMENT:'".$unit_text." Now Ave Max"; -if($percentile) { + +if ($percentile) +{ $rrd_options .= " ".$percentile."th %"; } + $rrd_options .= "\\n'"; $rrd_options .= " LINE1.25:in#".$colour_line_in.":'".$in_text."'"; $rrd_options .= " GPRINT:in:LAST:%6.2lf%s"; $rrd_options .= " GPRINT:in:AVERAGE:%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 .= " COMMENT:'\\n'"; $rrd_options .= " AREA:dout#".$colour_area_out.":"; $rrd_options .= " LINE1.25:dout#".$colour_line_out.":'".$out_text."'"; $rrd_options .= " GPRINT:out:LAST:%6.2lf%s"; $rrd_options .= " GPRINT:out:AVERAGE:%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 .= " COMMENT:\\\\n"; -if($print_total) { + +if ($print_total) +{ $rrd_options .= " GPRINT:tot:'Total %6.2lf%s'"; $rrd_options .= " GPRINT:totin:'(In %6.2lf%s'"; $rrd_options .= " GPRINT:totout:'Out %6.2lf%s)\\\\l'"; } -if($percentile) { + +if ($percentile) +{ $rrd_options .= " LINE1:percentile_in#aa0000"; $rrd_options .= " LINE1:dpercentile_out#aa0000"; } -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/generic_multi_bits.inc.php b/html/includes/graphs/generic_multi_bits.inc.php index 23d6bb226e..306e82345c 100644 --- a/html/includes/graphs/generic_multi_bits.inc.php +++ b/html/includes/graphs/generic_multi_bits.inc.php @@ -6,7 +6,9 @@ include("includes/graphs/common.inc.php"); $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:outoctets" . $i . "=".$rrd_filename.":".$rra_out.":AVERAGE"; $in_thing .= $seperator . "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF"; @@ -17,9 +19,9 @@ foreach($rrd_filenames as $rrd_filename) { $i++; } -if($i) +if ($i) { - if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } + if ($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; } $rrd_options .= " CDEF:".$in."octets=" . $in_thing . $pluses; $rrd_options .= " CDEF:".$out."octets=" . $out_thing . $pluses; $rrd_options .= " CDEF:doutoctets=outoctets,-1,*"; @@ -30,31 +32,32 @@ if($i) $rrd_options .= " VDEF:95thout=outbits,95,PERCENT"; $rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT"; - if($legend == 'no' || $legend == '1') { - $rrd_options .= " AREA:inbits#".$colour_area_in.":"; - $rrd_options .= " LINE1.25:inbits#".$colour_line_in.":"; - $rrd_options .= " AREA:doutbits#".$colour_area_out.":"; - $rrd_options .= " LINE1.25:doutbits#".$colour_line_out.":"; + if ($legend == 'no' || $legend == '1') + { + $rrd_options .= " AREA:inbits#".$colour_area_in.":"; + $rrd_options .= " LINE1.25:inbits#".$colour_line_in.":"; + $rrd_options .= " AREA:doutbits#".$colour_area_out.":"; + $rrd_options .= " LINE1.25:doutbits#".$colour_line_out.":"; } else { - $rrd_options .= " AREA:inbits#".$colour_area_in.":"; - $rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'"; - $rrd_options .= " LINE1.25:inbits#".$colour_line_in.":In\ "; - $rrd_options .= " GPRINT:inbits:LAST:%6.2lf%s"; - $rrd_options .= " GPRINT:inbits:AVERAGE:%6.2lf%s"; - $rrd_options .= " GPRINT:inbits:MAX:%6.2lf%s"; - $rrd_options .= " GPRINT:95thin:%6.2lf%s\\\\n"; - $rrd_options .= " AREA:doutbits#".$colour_area_out.":"; - $rrd_options .= " LINE1.25:doutbits#".$colour_line_out.":Out"; - $rrd_options .= " GPRINT:outbits:LAST:%6.2lf%s"; - $rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s"; - $rrd_options .= " GPRINT:outbits:MAX:%6.2lf%s"; - $rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n"; - + $rrd_options .= " AREA:inbits#".$colour_area_in.":"; + $rrd_options .= " COMMENT:'bps Now Ave Max 95th %\\n'"; + $rrd_options .= " LINE1.25:inbits#".$colour_line_in.":In\ "; + $rrd_options .= " GPRINT:inbits:LAST:%6.2lf%s"; + $rrd_options .= " GPRINT:inbits:AVERAGE:%6.2lf%s"; + $rrd_options .= " GPRINT:inbits:MAX:%6.2lf%s"; + $rrd_options .= " GPRINT:95thin:%6.2lf%s\\\\n"; + $rrd_options .= " AREA:doutbits#".$colour_area_out.":"; + $rrd_options .= " LINE1.25:doutbits#".$colour_line_out.":Out"; + $rrd_options .= " GPRINT:outbits:LAST:%6.2lf%s"; + $rrd_options .= " GPRINT:outbits:AVERAGE:%6.2lf%s"; + $rrd_options .= " GPRINT:outbits:MAX:%6.2lf%s"; + $rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n"; } + $rrd_options .= " LINE1:95thin#aa0000"; $rrd_options .= " LINE1:d95thout#aa0000"; } + #$rrd_options .= " HRULE:0#999999"; - -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/generic_multi_bits_separated.inc.php b/html/includes/graphs/generic_multi_bits_separated.inc.php index 1fa6ccddbc..74145d862c 100644 --- a/html/includes/graphs/generic_multi_bits_separated.inc.php +++ b/html/includes/graphs/generic_multi_bits_separated.inc.php @@ -1,48 +1,60 @@ + $rrd_options .= " HRULE:999999999999999#" . $colour_out . ":\\\s:"; + + if ($i) { $stack="STACK"; } + + $rrd_options .= " AREA:inB".$i."#" . $colour_in . ":'" . $descr . "':$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.":MAX:%6.2lf%s$units"; + + if (!$nototal) { $rrd_options .= " GPRINT:totin".$i.":%6.2lf%s$total_units"; } + + $rrd_options .= " COMMENT:' '"; + $rrd_options .= " GPRINT:outB".$i.":LAST:%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"; } + + $rrd_options .= " COMMENT:\\\\n"; + $i++; $iter++; +} + +$rrd_options .= $rrd_optionsb; +$rrd_options .= " HRULE:0#999999"; + +?> \ No newline at end of file diff --git a/html/includes/graphs/generic_multi_line.inc.php b/html/includes/graphs/generic_multi_line.inc.php index 3349c290db..2b255ecda1 100644 --- a/html/includes/graphs/generic_multi_line.inc.php +++ b/html/includes/graphs/generic_multi_line.inc.php @@ -1,43 +1,46 @@ + $rrd_options .= " GPRINT:".$id.":LAST:%5.2lf%s GPRINT:".$id."min:MIN:%5.2lf%s"; + $rrd_options .= " GPRINT:".$id."max:MAX:%5.2lf%s GPRINT:".$id.":AVERAGE:%5.2lf%s\\\\n"; + + $i++; $iter++; +} + +?> \ No newline at end of file diff --git a/html/includes/graphs/generic_multi_seperated.inc.php b/html/includes/graphs/generic_multi_seperated.inc.php index 363b3d242d..5cc8d81a7e 100644 --- a/html/includes/graphs/generic_multi_seperated.inc.php +++ b/html/includes/graphs/generic_multi_seperated.inc.php @@ -6,18 +6,18 @@ $units_descr = substr(str_pad($units_descr, 18),0,18); $i = 0; $rrd_options .= " COMMENT:'$units_descr Current Average Maximum\\n'"; -if(!$nototal) {$rrd_options .= " COMMENT:' Tot'";} +if (!$nototal) { $rrd_options .= " COMMENT:' Tot'"; } $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_out=$config['graph_colours'][$colours_out][$iter]; - if($rrd['colour_area_in']) { $colour_in = $rrd['colour_area_in']; } - if($rrd['colour_area_out']) {$colour_out = $rrd['colour_area_out']; } + if ($rrd['colour_area_in']) { $colour_in = $rrd['colour_area_in']; } + if ($rrd['colour_area_out']) { $colour_out = $rrd['colour_area_out']; } $rrd_options .= " DEF:in".$i."=".$rrd['filename'].":".$rrd['rra_in'].":AVERAGE "; $rrd_options .= " DEF:out".$i."=".$rrd['filename'].":".$rrd['rra_out'].":AVERAGE "; @@ -25,31 +25,31 @@ foreach($rrd_list as $rrd) $rrd_options .= " CDEF:outB".$i."=out".$i.",$multiplier,*"; $rrd_options .= " CDEF:outB".$i."_neg=outB".$i.",-1,*"; $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:totout".$i."=outB".$i.",TOTAL"; $rrd_options .= " VDEF:tot".$i."=octets".$i.",TOTAL"; } - - if($i) {$stack="STACK";} - + + if ($i) { $stack="STACK"; } + $rrd_options .= " AREA:inB".$i."#" . $colour_in . ":'" . substr(str_pad($rrd['descr'], 10),0,10) . "In ':$stack"; $rrd_options .= " GPRINT:inB".$i.":LAST:%6.2lf%s"; $rrd_options .= " GPRINT:inB".$i.":AVERAGE:%6.2lf%s"; $rrd_options .= " GPRINT:inB".$i.":MAX:%6.2lf%s"; - 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:'\\n'"; $rrd_optionsb .= " AREA:outB".$i."_neg#" . $colour_out . "::$stack"; $rrd_options .= " HRULE:999999999999999#" . $colour_out . ":'" . substr(str_pad('', 10),0,10) . "Out':"; $rrd_options .= " GPRINT:outB".$i.":LAST:%6.2lf%s"; $rrd_options .= " GPRINT:outB".$i.":AVERAGE:%6.2lf%s"; $rrd_options .= " GPRINT:outB".$i.":MAX:%6.2lf%s"; - - 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'"; $i++; $iter++; } @@ -57,4 +57,4 @@ foreach($rrd_list as $rrd) $rrd_options .= $rrd_optionsb; $rrd_options .= " HRULE:0#999999"; -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/generic_multi_simplex_seperated.inc.php b/html/includes/graphs/generic_multi_simplex_seperated.inc.php index 29756e1866..9522cae6e1 100644 --- a/html/includes/graphs/generic_multi_simplex_seperated.inc.php +++ b/html/includes/graphs/generic_multi_simplex_seperated.inc.php @@ -1,29 +1,34 @@ + if ($i) { $stack="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."max:MAX:%6.2lf%s$units"; + + if (!$nototal) { $rrd_options .= " GPRINT:tot".$rrd['rra'].$i.":%6.2lf%s$total_units"; } + + $rrd_options .= " COMMENT:'\\n'"; + $i++; $iter++; +} + +?> \ No newline at end of file diff --git a/html/includes/graphs/generic_simplex.inc.php b/html/includes/graphs/generic_simplex.inc.php index 43bbcd7810..5046f85d45 100644 --- a/html/includes/graphs/generic_simplex.inc.php +++ b/html/includes/graphs/generic_simplex.inc.php @@ -11,37 +11,50 @@ $line_text = str_pad(truncate($line_text,12,''),12); $rrd_options .= " DEF:".$rra."=".$rrd_filename.":".$rra.":AVERAGE"; $rrd_options .= " DEF:".$rra."_max=".$rrd_filename.":".$rra.":MAX"; -if($print_total) { +if ($print_total) +{ $rrd_options .= " VDEF:".$rra."_total=rra,TOTAL"; } -if($percentile) { +if ($percentile) +{ $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."#".$colour_area.":"; $rrd_options .= " COMMENT:'".$unit_text."Now Ave Max"; -if($percentile) { + +if ($percentile) +{ $rrd_options .= " ".$percentile."th %"; } + $rrd_options .= "\\n'"; $rrd_options .= " LINE1.25:".$rra."#".$colour_line.":'".$line_text."'"; $rrd_options .= " GPRINT:".$rra.":LAST:%6.2lf%s"; $rrd_options .= " GPRINT:".$rra.":AVERAGE:%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 .= "\\\\n"; $rrd_options .= " COMMENT:\\\\n"; -if($print_total) { + +if ($print_total) +{ $rrd_options .= " GPRINT:".$rra."_tot:Total\ %6.2lf%s\)\\\\l"; } -if($percentile) { + +if ($percentile) +{ $rrd_options .= " LINE1:".$rra."_percentile#aa0000"; } -?> +?> \ No newline at end of file diff --git a/html/includes/graphs/graph.inc.php b/html/includes/graphs/graph.inc.php index 511691fb5f..f195a52918 100644 --- a/html/includes/graphs/graph.inc.php +++ b/html/includes/graphs/graph.inc.php @@ -47,7 +47,7 @@ preg_match('/^(?P[A-Za-z0-9]+)_(?P.+)/', mres($_GET['type']), $gr $type = $graphtype['type']; $subtype = $graphtype['subtype']; -if ($debug) {print_r($graphtype);} +if ($debug) {print_r($graphtype); } $graphfile = $config['temp_dir'] . "/" . strgen() . ".png"; @@ -79,8 +79,9 @@ else function graph_error($string) { - global $width, $height; - header('Content-type: image/png'); + global $width, $height, $debug; + + if (!$debug) { header('Content-type: image/png'); } if ($height > "99") { $width +=75; } $im = imagecreate($width, $height); $orange = imagecolorallocate($im, 255, 225, 225); @@ -115,8 +116,8 @@ if (!$auth) if ($config['rrdcached']) { $rrd_switches = " --daemon ".$config['rrdcached'] . " "; } $rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches; $woo = shell_exec($rrd_cmd); - if ($_GET['debug']) { echo("
".$rrd_cmd."
"); } - if (is_file($graphfile)) + if ($debug) { echo("
".$rrd_cmd."
"); } + if (is_file($graphfile)) { header('Content-type: image/png'); $fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd); diff --git a/html/includes/graphs/screenos_sessions.inc.php b/html/includes/graphs/screenos_sessions.inc.php index dbbe83273e..b79e285c6e 100644 --- a/html/includes/graphs/screenos_sessions.inc.php +++ b/html/includes/graphs/screenos_sessions.inc.php @@ -18,17 +18,13 @@ $rrd_list[2]['filename'] = $file; $rrd_list[2]['descr'] = "Failed"; $rrd_list[2]['rra'] = "failed"; - -if ($_GET['debug']) { print_r($rrd_list); } +if ($_GET['debug']) { print_r($rrd_list); } $colours = "mixed"; $nototal = 1; $unit_text = "Sessions"; $scale_min = "0"; - include ("generic_multi_simplex_seperated.inc.php"); - - -?> +?> \ No newline at end of file