mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Overhaul use of rrdtool_lastupdate & STACK for rrdtool 1.4/1.5 compatibility
This commit is contained in:
@ -39,7 +39,7 @@ $rrd_options .= ' GPRINT:availreal:LAST:\ \ \ %7.2lf%sB';
|
|||||||
$rrd_options .= ' GPRINT:availreal:AVERAGE:%7.2lf%sB';
|
$rrd_options .= ' GPRINT:availreal:AVERAGE:%7.2lf%sB';
|
||||||
$rrd_options .= " GPRINT:availreal:MAX:%7.2lf%sB\\\\n";
|
$rrd_options .= " GPRINT:availreal:MAX:%7.2lf%sB\\\\n";
|
||||||
$rrd_options .= ' LINE1:usedreal#d0b080:';
|
$rrd_options .= ' LINE1:usedreal#d0b080:';
|
||||||
$rrd_options .= ' AREA:shared#afeced::';
|
$rrd_options .= ' AREA:shared#afeced:';
|
||||||
$rrd_options .= ' AREA:buffered#cc0000::STACK';
|
$rrd_options .= ' AREA:buffered#cc0000::STACK';
|
||||||
$rrd_options .= ' AREA:cached#ffaa66::STACK';
|
$rrd_options .= ' AREA:cached#ffaa66::STACK';
|
||||||
$rrd_options .= ' LINE1.25:shared#008fea:shared';
|
$rrd_options .= ' LINE1.25:shared#008fea:shared';
|
||||||
|
@ -53,14 +53,14 @@ else {
|
|||||||
foreach ($rrd_list as $rrd) {
|
foreach ($rrd_list as $rrd) {
|
||||||
$colours = (isset($rrd['colour']) ? $rrd['colour'] : 'default');
|
$colours = (isset($rrd['colour']) ? $rrd['colour'] : 'default');
|
||||||
$strlen = ((strlen($rrd['descr']) < $descr_len) ? ($descr_len - strlen($rrd['descr'])) : '0');
|
$strlen = ((strlen($rrd['descr']) < $descr_len) ? ($descr_len - strlen($rrd['descr'])) : '0');
|
||||||
$descr = (isset($rrd['descr']) ? rrdtool_escape($rrd['descr'], ($desc_len + $strlen)) : 'Unkown');
|
$descr = (isset($rrd['descr']) ? rrdtool_escape($rrd['descr'], ($desc_len + $strlen)) : 'Unknown');
|
||||||
for ($z = 0; $z < $strlen;
|
for ($z = 0; $z < $strlen;
|
||||||
$z++) {
|
$z++) {
|
||||||
$descr .= ' ';
|
$descr .= ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($i) {
|
if ($i) {
|
||||||
$stack = 'STACK';
|
$stack = ':STACK';
|
||||||
}
|
}
|
||||||
|
|
||||||
$colour = $config['graph_colours'][$colours][$x];
|
$colour = $config['graph_colours'][$colours][$x];
|
||||||
@ -68,7 +68,7 @@ foreach ($rrd_list as $rrd) {
|
|||||||
$rrd_options .= ' DEF:peak'.$x.'='.$rrd['filename'].':peak:MAX';
|
$rrd_options .= ' DEF:peak'.$x.'='.$rrd['filename'].':peak:MAX';
|
||||||
$rrd_options .= ' DEF:unique'.$x.'='.$rrd['filename'].':unique:AVERAGE';
|
$rrd_options .= ' DEF:unique'.$x.'='.$rrd['filename'].':unique:AVERAGE';
|
||||||
$rrd_options .= ' VDEF:avg'.$x.'=cur'.$x.',AVERAGE';
|
$rrd_options .= ' VDEF:avg'.$x.'=cur'.$x.',AVERAGE';
|
||||||
$rrd_options .= ' AREA:cur'.$x.'#'.$colour.':"'.$descr."\":$stack";
|
$rrd_options .= ' AREA:cur'.$x.'#'.$colour.":'".$descr."'$stack";
|
||||||
$rrd_options .= ' GPRINT:cur'.$x.':LAST:"%6.2lf"';
|
$rrd_options .= ' GPRINT:cur'.$x.':LAST:"%6.2lf"';
|
||||||
$rrd_options .= ' GPRINT:unique'.$x.':LAST:"%6.2lf%s"';
|
$rrd_options .= ' GPRINT:unique'.$x.':LAST:"%6.2lf%s"';
|
||||||
$rrd_options .= ' GPRINT:avg'.$x.':"%6.2lf"';
|
$rrd_options .= ' GPRINT:avg'.$x.':"%6.2lf"';
|
||||||
@ -97,7 +97,7 @@ if (!$nototal) {
|
|||||||
$rrd_options .= ' CDEF:totunique=unique0'.$totunique;
|
$rrd_options .= ' CDEF:totunique=unique0'.$totunique;
|
||||||
$rrd_options .= ' CDEF:totpeak=peak0'.$totpeak;
|
$rrd_options .= ' CDEF:totpeak=peak0'.$totpeak;
|
||||||
$rrd_options .= ' VDEF:totavg=totcur,AVERAGE';
|
$rrd_options .= ' VDEF:totavg=totcur,AVERAGE';
|
||||||
$rrd_options .= ' LINE2:totcur#'.$colour.':"'.$descr.'"';
|
$rrd_options .= ' LINE2:totcur#'.$colour.":'".$descr."'";
|
||||||
$rrd_options .= ' GPRINT:totcur:LAST:"%6.2lf"';
|
$rrd_options .= ' GPRINT:totcur:LAST:"%6.2lf"';
|
||||||
$rrd_options .= ' GPRINT:totunique:LAST:"%6.2lf%s"';
|
$rrd_options .= ' GPRINT:totunique:LAST:"%6.2lf%s"';
|
||||||
$rrd_options .= ' GPRINT:totavg:"%6.2lf"';
|
$rrd_options .= ' GPRINT:totavg:"%6.2lf"';
|
||||||
|
@ -46,7 +46,7 @@ foreach (dbFetchRows('SELECT * FROM `mempools` where `device_id` = ?', array($de
|
|||||||
$rrd_optionsb .= " LINE1:mempooltotal$i#".$colour.":'".$descr."' ";
|
$rrd_optionsb .= " LINE1:mempooltotal$i#".$colour.":'".$descr."' ";
|
||||||
$rrd_optionsb .= " GPRINT:mempooltotal$i:MIN:%3.0lf%%";
|
$rrd_optionsb .= " GPRINT:mempooltotal$i:MIN:%3.0lf%%";
|
||||||
$rrd_optionsb .= " GPRINT:mempooltotal$i:LAST:%3.0lf%%";
|
$rrd_optionsb .= " GPRINT:mempooltotal$i:LAST:%3.0lf%%";
|
||||||
$rrd_optionsb .= " GPRINT:mempooltotal$i:MAX:%3.0lf%%\\\l ";
|
$rrd_optionsb .= " GPRINT:mempooltotal$i:MAX:%3.0lf%%\\l ";
|
||||||
$iter++;
|
$iter++;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filena
|
|||||||
$colour = $config['graph_colours'][$colourset][$iter];
|
$colour = $config['graph_colours'][$colourset][$iter];
|
||||||
$iter++;
|
$iter++;
|
||||||
|
|
||||||
|
// FIXME: $descr unused? -- PDG 2015-11-14
|
||||||
$descr = rrdtool_escape($source, $descr_len);
|
$descr = rrdtool_escape($source, $descr_len);
|
||||||
|
|
||||||
$filename = generate_smokeping_file($device,$filename);
|
$filename = generate_smokeping_file($device,$filename);
|
||||||
|
@ -42,6 +42,6 @@ foreach (dbFetchRows('SELECT * FROM storage where device_id = ?', array($device[
|
|||||||
$rrd_options .= " LINE1.25:$storage[storage_id]perc#".$colour.":'$descr'";
|
$rrd_options .= " LINE1.25:$storage[storage_id]perc#".$colour.":'$descr'";
|
||||||
$rrd_options .= " GPRINT:$storage[storage_id]size:LAST:%6.2lf%sB";
|
$rrd_options .= " GPRINT:$storage[storage_id]size:LAST:%6.2lf%sB";
|
||||||
$rrd_options .= " GPRINT:$storage[storage_id]used:LAST:%6.2lf%sB";
|
$rrd_options .= " GPRINT:$storage[storage_id]used:LAST:%6.2lf%sB";
|
||||||
$rrd_options .= " GPRINT:$storage[storage_id]perc:LAST:%5.2lf%%\\\\l";
|
$rrd_options .= " GPRINT:$storage[storage_id]perc:LAST:%5.2lf%%\\l";
|
||||||
$iter++;
|
$iter++;
|
||||||
}//end foreach
|
}//end foreach
|
||||||
|
@ -14,12 +14,12 @@ $rrd_options .= ' CDEF:b=5min,100,/';
|
|||||||
$rrd_options .= ' CDEF:c=15min,100,/';
|
$rrd_options .= ' CDEF:c=15min,100,/';
|
||||||
$rrd_options .= ' CDEF:cdefd=a,b,c,+,+';
|
$rrd_options .= ' CDEF:cdefd=a,b,c,+,+';
|
||||||
$rrd_options .= " COMMENT:'Load Average Current Average Maximum\\n'";
|
$rrd_options .= " COMMENT:'Load Average Current Average Maximum\\n'";
|
||||||
$rrd_options .= " AREA:a#ffeeaa:'1 Min':";
|
$rrd_options .= " AREA:a#ffeeaa:'1 Min'";
|
||||||
$rrd_options .= ' LINE1:a#c5aa00:';
|
$rrd_options .= ' LINE1:a#c5aa00:';
|
||||||
$rrd_options .= " GPRINT:a:LAST:' %7.2lf'";
|
$rrd_options .= " GPRINT:a:LAST:' %7.2lf'";
|
||||||
$rrd_options .= " GPRINT:a:AVERAGE:' %7.2lf'";
|
$rrd_options .= " GPRINT:a:AVERAGE:' %7.2lf'";
|
||||||
$rrd_options .= " GPRINT:a:MAX:' %7.2lf\\n'";
|
$rrd_options .= " GPRINT:a:MAX:' %7.2lf\\n'";
|
||||||
$rrd_options .= " LINE1.25:b#ea8f00:'5 Min':";
|
$rrd_options .= " LINE1.25:b#ea8f00:'5 Min'";
|
||||||
$rrd_options .= " GPRINT:b:LAST:' %7.2lf'";
|
$rrd_options .= " GPRINT:b:LAST:' %7.2lf'";
|
||||||
$rrd_options .= " GPRINT:b:AVERAGE:' %7.2lf'";
|
$rrd_options .= " GPRINT:b:AVERAGE:' %7.2lf'";
|
||||||
$rrd_options .= " GPRINT:b:MAX:' %7.2lf\\n'";
|
$rrd_options .= " GPRINT:b:MAX:' %7.2lf\\n'";
|
||||||
|
@ -73,7 +73,7 @@ $rrd_options .= " 'COMMENT: \\n'";
|
|||||||
|
|
||||||
$rrd_options .= " 'LINE1:usedreal#d0b080:'";
|
$rrd_options .= " 'LINE1:usedreal#d0b080:'";
|
||||||
|
|
||||||
$rrd_options .= " 'AREA:shared#afeced::'";
|
$rrd_options .= " 'AREA:shared#afeced:'";
|
||||||
$rrd_options .= " 'AREA:buffered#cc0000::STACK'";
|
$rrd_options .= " 'AREA:buffered#cc0000::STACK'";
|
||||||
$rrd_options .= " 'AREA:cached#ffaa66::STACK'";
|
$rrd_options .= " 'AREA:cached#ffaa66::STACK'";
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ $rrd_options .= ' LINE:in'.$format."#608720:'In '";
|
|||||||
$rrd_options .= ' GPRINT:in'.$format.':LAST:%6.2lf%s';
|
$rrd_options .= ' GPRINT:in'.$format.':LAST:%6.2lf%s';
|
||||||
$rrd_options .= ' GPRINT:in'.$format.':AVERAGE:%6.2lf%s';
|
$rrd_options .= ' GPRINT:in'.$format.':AVERAGE:%6.2lf%s';
|
||||||
$rrd_options .= ' GPRINT:in'.$format.'_max:MAX:%6.2lf%s';
|
$rrd_options .= ' GPRINT:in'.$format.'_max:MAX:%6.2lf%s';
|
||||||
$rrd_options .= " GPRINT:95thin:%6.2lf%s\\\\n";
|
$rrd_options .= " GPRINT:95thin:%6.2lf%s\\n";
|
||||||
|
|
||||||
$rrd_options .= ' AREA:dout'.$format.'_max#E0E0FF:';
|
$rrd_options .= ' AREA:dout'.$format.'_max#E0E0FF:';
|
||||||
$rrd_options .= ' AREA:dout'.$format.'#8080C0:';
|
$rrd_options .= ' AREA:dout'.$format.'#8080C0:';
|
||||||
@ -116,7 +116,7 @@ $rrd_options .= ' LINE:dout'.$format."#606090:'Out'";
|
|||||||
$rrd_options .= ' GPRINT:out'.$format.':LAST:%6.2lf%s';
|
$rrd_options .= ' GPRINT:out'.$format.':LAST:%6.2lf%s';
|
||||||
$rrd_options .= ' GPRINT:out'.$format.':AVERAGE:%6.2lf%s';
|
$rrd_options .= ' GPRINT:out'.$format.':AVERAGE:%6.2lf%s';
|
||||||
$rrd_options .= ' GPRINT:out'.$format.'_max:MAX:%6.2lf%s';
|
$rrd_options .= ' GPRINT:out'.$format.'_max:MAX:%6.2lf%s';
|
||||||
$rrd_options .= " GPRINT:95thout:%6.2lf%s\\\\n";
|
$rrd_options .= " GPRINT:95thout:%6.2lf%s\\n";
|
||||||
|
|
||||||
if ($config['rrdgraph_real_95th']) {
|
if ($config['rrdgraph_real_95th']) {
|
||||||
$rrd_options .= ' HRULE:95thhigh#FF0000:"Highest"';
|
$rrd_options .= ' HRULE:95thhigh#FF0000:"Highest"';
|
||||||
@ -125,7 +125,7 @@ if ($config['rrdgraph_real_95th']) {
|
|||||||
|
|
||||||
$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';
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($nototal) {
|
if ($nototal) {
|
||||||
$descrlen += '2';
|
$descr_len += '2';
|
||||||
$unitlen += '2';
|
$unitlen += '2';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,16 +57,16 @@ foreach ($rrd_list as $rrd) {
|
|||||||
|
|
||||||
if ($rrd['invert']) {
|
if ($rrd['invert']) {
|
||||||
$rrd_options .= ' CDEF:'.$id.'i='.$id.',-1,*';
|
$rrd_options .= ' CDEF:'.$id.'i='.$id.',-1,*';
|
||||||
$rrd_optionsc .= ' AREA:'.$id.'i#'.$colour.":'$descr':".$cstack;
|
$rrd_optionsc .= ' AREA:'.$id.'i#'.$colour.":'$descr'".$cstack;
|
||||||
$rrd_optionsc .= ' GPRINT:'.$id.':LAST:%5.1lf%s GPRINT:'.$id.'min:MIN:%5.1lf%s';
|
$rrd_optionsc .= ' GPRINT:'.$id.':LAST:%5.1lf%s GPRINT:'.$id.'min:MIN:%5.1lf%s';
|
||||||
$rrd_optionsc .= ' GPRINT:'.$id.'max:MAX:%5.1lf%s GPRINT:'.$id.":AVERAGE:'%5.1lf%s\\n'";
|
$rrd_optionsc .= ' GPRINT:'.$id.'max:MAX:%5.1lf%s GPRINT:'.$id.":AVERAGE:'%5.1lf%s\\n'";
|
||||||
$cstack = 'STACK';
|
$cstack = ':STACK';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$rrd_optionsb .= ' AREA:'.$id.'#'.$colour.":'$descr':".$bstack;
|
$rrd_optionsb .= ' AREA:'.$id.'#'.$colour.":'$descr'".$bstack;
|
||||||
$rrd_optionsb .= ' GPRINT:'.$id.':LAST:%5.1lf%s GPRINT:'.$id.'min:MIN:%5.1lf%s';
|
$rrd_optionsb .= ' GPRINT:'.$id.':LAST:%5.1lf%s GPRINT:'.$id.'min:MIN:%5.1lf%s';
|
||||||
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.1lf%s GPRINT:'.$id.":AVERAGE:'%5.1lf%s\\n'";
|
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.1lf%s GPRINT:'.$id.":AVERAGE:'%5.1lf%s\\n'";
|
||||||
$bstack = 'STACK';
|
$bstack = ':STACK';
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
@ -49,9 +49,6 @@ foreach ($rrd_list as $rrd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$descr_out = rrdtool_escape($rrd['descr_out'], $descr_len).' Out';
|
$descr_out = rrdtool_escape($rrd['descr_out'], $descr_len).' Out';
|
||||||
$descr = str_replace("'", '', $descr);
|
|
||||||
// FIXME does this mean ' should be filtered in rrdtool_escape? probably...
|
|
||||||
$descr_out = str_replace("'", '', $descr_out);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= ' DEF:'.$in.$i.'='.$rrd['filename'].':'.$ds_in.':AVERAGE ';
|
$rrd_options .= ' DEF:'.$in.$i.'='.$rrd['filename'].':'.$ds_in.':AVERAGE ';
|
||||||
@ -68,10 +65,10 @@ foreach ($rrd_list as $rrd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($i) {
|
if ($i) {
|
||||||
$stack = 'STACK';
|
$stack = ':STACK';
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= ' AREA:inB'.$i.'#'.$colour_in.":'".$descr."':$stack";
|
$rrd_options .= ' AREA:inB'.$i.'#'.$colour_in.":'".$descr."'$stack";
|
||||||
if (!$nodetails) {
|
if (!$nodetails) {
|
||||||
$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.":AVERAGE:%6.2lf%s$units";
|
$rrd_options .= ' GPRINT:inB'.$i.":AVERAGE:%6.2lf%s$units";
|
||||||
@ -84,7 +81,7 @@ foreach ($rrd_list as $rrd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= " 'HRULE:0#".$colour_out.':'.$descr_out."'";
|
$rrd_options .= " 'HRULE:0#".$colour_out.':'.$descr_out."'";
|
||||||
$rrd_optionsb .= " 'AREA:outB".$i.'_neg#'.$colour_out."::$stack'";
|
$rrd_optionsb .= " 'AREA:outB".$i.'_neg#'.$colour_out.":$stack'";
|
||||||
|
|
||||||
if (!$nodetails) {
|
if (!$nodetails) {
|
||||||
$rrd_options .= ' GPRINT:outB'.$i.":LAST:%6.2lf%s$units";
|
$rrd_options .= ' GPRINT:outB'.$i.":LAST:%6.2lf%s$units";
|
||||||
|
@ -45,9 +45,6 @@ foreach ($rrd_list as $rrd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$descr_out = rrdtool_escape($rrd['descr_out'], $descr_len).' Out';
|
$descr_out = rrdtool_escape($rrd['descr_out'], $descr_len).' Out';
|
||||||
$descr = str_replace("'", '', $descr);
|
|
||||||
// FIXME does this mean ' should be filtered in rrdtool_escape? probably...
|
|
||||||
$descr_out = str_replace("'", '', $descr_out);
|
|
||||||
|
|
||||||
$rrd_options .= ' DEF:'.$in.$i.'='.$rrd['filename'].':'.$ds_in.':AVERAGE ';
|
$rrd_options .= ' DEF:'.$in.$i.'='.$rrd['filename'].':'.$ds_in.':AVERAGE ';
|
||||||
$rrd_options .= ' DEF:'.$out.$i.'='.$rrd['filename'].':'.$ds_out.':AVERAGE ';
|
$rrd_options .= ' DEF:'.$out.$i.'='.$rrd['filename'].':'.$ds_out.':AVERAGE ';
|
||||||
@ -69,10 +66,10 @@ foreach ($rrd_list as $rrd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($i) {
|
if ($i) {
|
||||||
$stack = 'STACK';
|
$stack = ':STACK';
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= ' AREA:inB'.$i.'#'.$colour_in.":'".$descr."':$stack";
|
$rrd_options .= ' AREA:inB'.$i.'#'.$colour_in.":'".$descr."'$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.":AVERAGE:%6.2lf%s$units";
|
$rrd_options .= ' GPRINT:inB'.$i.":AVERAGE:%6.2lf%s$units";
|
||||||
$rrd_options .= ' GPRINT:inB'.$i.":MAX:%6.2lf%s$units\l";
|
$rrd_options .= ' GPRINT:inB'.$i.":MAX:%6.2lf%s$units\l";
|
||||||
@ -82,7 +79,7 @@ foreach ($rrd_list as $rrd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= " 'HRULE:0#".$colour_out.':'.$descr_out."'";
|
$rrd_options .= " 'HRULE:0#".$colour_out.':'.$descr_out."'";
|
||||||
$rrd_optionsb .= " 'AREA:outB".$i.'_neg#'.$colour_out."::$stack'";
|
$rrd_optionsb .= " 'AREA:outB".$i.'_neg#'.$colour_out.":$stack'";
|
||||||
$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.":AVERAGE:%6.2lf%s$units";
|
$rrd_options .= ' GPRINT:outB'.$i.":AVERAGE:%6.2lf%s$units";
|
||||||
$rrd_options .= ' GPRINT:outB'.$i.":MAX:%6.2lf%s$units\l";
|
$rrd_options .= ' GPRINT:outB'.$i.":MAX:%6.2lf%s$units\l";
|
||||||
@ -117,7 +114,7 @@ if (!$nototal) {
|
|||||||
$rrd_options .= ' VDEF:totout=outoctets,TOTAL';
|
$rrd_options .= ' VDEF:totout=outoctets,TOTAL';
|
||||||
$rrd_options .= ' VDEF:tot=octets,TOTAL';
|
$rrd_options .= ' VDEF:tot=octets,TOTAL';
|
||||||
|
|
||||||
// $rrd_options .= " AREA:totin#" . $colour_in . ":'" . $descr . "':$stack";
|
// $rrd_options .= " AREA:totin#" . $colour_in . ":'" . $descr . "'$stack";
|
||||||
// $rrd_options .= " GPRINT:totin:LAST:%6.2lf%s$units";
|
// $rrd_options .= " GPRINT:totin:LAST:%6.2lf%s$units";
|
||||||
// $rrd_options .= " GPRINT:totin:AVERAGE:%6.2lf%s$units";
|
// $rrd_options .= " GPRINT:totin:AVERAGE:%6.2lf%s$units";
|
||||||
// $rrd_options .= " GPRINT:totin:MAX:%6.2lf%s$units\l";
|
// $rrd_options .= " GPRINT:totin:MAX:%6.2lf%s$units\l";
|
||||||
|
@ -11,7 +11,7 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($nototal) {
|
if ($nototal) {
|
||||||
$descrlen += '2';
|
$descr_len += '2';
|
||||||
$unitlen += '2';
|
$unitlen += '2';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ foreach ($rrd_list as $rrd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($i) {
|
if ($i) {
|
||||||
$stack = 'STACK';
|
$stack = ':STACK';
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= ' AREA:inbits'.$i.'#'.$colour_in.":'".rrdtool_escape($rrd['descr'], 9)."In '$stack";
|
$rrd_options .= ' AREA:inbits'.$i.'#'.$colour_in.":'".rrdtool_escape($rrd['descr'], 9)."In '$stack";
|
||||||
@ -84,7 +84,7 @@ foreach ($rrd_list as $rrd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= " COMMENT:'\\n'";
|
$rrd_options .= " COMMENT:'\\n'";
|
||||||
$rrd_optionsb .= ' AREA:outbits'.$i.'_neg#'.$colour_out.":$stack";
|
$rrd_optionsb .= ' AREA:outbits'.$i.'_neg#'.$colour_out."$stack";
|
||||||
$rrd_options .= ' HRULE:999999999999999#'.$colour_out.":'".str_pad('', 10)."Out'";
|
$rrd_options .= ' HRULE:999999999999999#'.$colour_out.":'".str_pad('', 10)."Out'";
|
||||||
$rrd_options .= ' GPRINT:outbits'.$i.':LAST:%6.2lf%s';
|
$rrd_options .= ' GPRINT:outbits'.$i.':LAST:%6.2lf%s';
|
||||||
$rrd_options .= ' GPRINT:outbits'.$i.':AVERAGE:%6.2lf%s';
|
$rrd_options .= ' GPRINT:outbits'.$i.':AVERAGE:%6.2lf%s';
|
||||||
|
@ -12,7 +12,7 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($nototal) {
|
if ($nototal) {
|
||||||
$descrlen += '2';
|
$descr_len += '2';
|
||||||
$unitlen += '2';
|
$unitlen += '2';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ else {
|
|||||||
|
|
||||||
$unitlen = '10';
|
$unitlen = '10';
|
||||||
if ($nototal) {
|
if ($nototal) {
|
||||||
$descrlen += '2';
|
$descr_len += '2';
|
||||||
$unitlen += '2';
|
$unitlen += '2';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ foreach ($rrd_list as $i => $rrd) {
|
|||||||
|
|
||||||
// This this not the first entry?
|
// This this not the first entry?
|
||||||
if ($i) {
|
if ($i) {
|
||||||
$stack = 'STACK';
|
$stack = ':STACK';
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we've been passed a multiplier we must make a CDEF based on it!
|
// if we've been passed a multiplier we must make a CDEF based on it!
|
||||||
@ -109,13 +109,13 @@ foreach ($rrd_list as $i => $rrd) {
|
|||||||
$t_defname = $g_defname;
|
$t_defname = $g_defname;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= ' AREA:'.$g_defname.$i.'#'.$colour.":'".$descr."':$stack";
|
$rrd_options .= ' AREA:'.$g_defname.$i.'#'.$colour.":'".$descr."'$stack";
|
||||||
|
|
||||||
$rrd_options .= ' GPRINT:'.$t_defname.$i.':LAST:%5.2lf%s GPRINT:'.$t_defname.$i.'min:MIN:%5.2lf%s';
|
$rrd_options .= ' GPRINT:'.$t_defname.$i.':LAST:%5.2lf%s GPRINT:'.$t_defname.$i.'min:MIN:%5.2lf%s';
|
||||||
$rrd_options .= ' GPRINT:'.$t_defname.$i.'max:MAX:%5.2lf%s GPRINT:'.$t_defname.$i.":AVERAGE:'%5.2lf%s\\n'";
|
$rrd_options .= ' GPRINT:'.$t_defname.$i.'max:MAX:%5.2lf%s GPRINT:'.$t_defname.$i.":AVERAGE:'%5.2lf%s\\n'";
|
||||||
|
|
||||||
if (!$nototal) {
|
if (!$nototal) {
|
||||||
$rrd_options .= ' GPRINT:tot'.$rrd['ds'].$i.':%6.2lf%s'.rrdtool_escape($total_units).'';
|
$rrd_options .= ' GPRINT:tot'.$rrd['ds'].$i.":%6.2lf%s'".rrdtool_escape($total_units)."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$rrd_options .= " COMMENT:'\\n'";
|
$rrd_options .= " COMMENT:'\\n'";
|
||||||
|
@ -50,7 +50,7 @@ foreach ($dbq as $ds) {
|
|||||||
|
|
||||||
$descr = rrdtool_escape($ds['ds_label'], $descr_len);
|
$descr = rrdtool_escape($ds['ds_label'], $descr_len);
|
||||||
|
|
||||||
$cmd_graph .= ' '.$ds['ds_draw'].':'.$ds_name.'#'.$colour.':"'.$descr.'"';
|
$cmd_graph .= ' '.$ds['ds_draw'].':'.$ds_name.'#'.$colour.":'".$descr."'";
|
||||||
$cmd_graph .= ' GPRINT:'.$ds_name.':LAST:"%6.2lf%s"';
|
$cmd_graph .= ' GPRINT:'.$ds_name.':LAST:"%6.2lf%s"';
|
||||||
$cmd_graph .= ' GPRINT:'.$ds_name.':AVERAGE:"%6.2lf%s"';
|
$cmd_graph .= ' GPRINT:'.$ds_name.':AVERAGE:"%6.2lf%s"';
|
||||||
$cmd_graph .= ' GPRINT:'.$ds_name.':MAX:"%6.2lf%s\\n"';
|
$cmd_graph .= ' GPRINT:'.$ds_name.':MAX:"%6.2lf%s\\n"';
|
||||||
|
@ -20,7 +20,7 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($print_total) {
|
if ($print_total) {
|
||||||
$rrd_options .= ' VDEF:'.$ds.'_total=ds,TOTAL';
|
$rrd_options .= ' VDEF:'.$ds.'_total='.$ds.',TOTAL';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($percentile) {
|
if ($percentile) {
|
||||||
@ -43,7 +43,7 @@ if ($_GET['previous'] == 'yes') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($print_total) {
|
if ($print_total) {
|
||||||
$rrd_options .= ' VDEF:'.$ds.'_totalX=ds,TOTAL';
|
$rrd_options .= ' VDEF:'.$ds.'_totalX='.$ds.',TOTAL';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($percentile) {
|
if ($percentile) {
|
||||||
@ -74,11 +74,11 @@ if ($percentile) {
|
|||||||
$rrd_options .= ' GPRINT:'.$ds.'_percentile:%6.2lf%s';
|
$rrd_options .= ' GPRINT:'.$ds.'_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:'.$ds.'_tot:Total\ %6.2lf%s\)\\\\l';
|
$rrd_options .= ' GPRINT:'.$ds.'_total:Total" %6.2lf%s"\\l';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($percentile) {
|
if ($percentile) {
|
||||||
@ -86,6 +86,6 @@ if ($percentile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET['previous'] == 'yes') {
|
if ($_GET['previous'] == 'yes') {
|
||||||
$rrd_options .= ' LINE1.25:'.$ds."X#666666:'Prev \\\\n'";
|
$rrd_options .= ' LINE1.25:'.$ds."X#666666:'Prev \\n'";
|
||||||
$rrd_options .= ' AREA:'.$ds.'X#99999966:';
|
$rrd_options .= ' AREA:'.$ds.'X#99999966:';
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ $scale_max = '100';
|
|||||||
|
|
||||||
$ds = 'usage';
|
$ds = 'usage';
|
||||||
|
|
||||||
|
// FIXME: As far as I can tell, $descr is never mentioned in includes/graphs/generic_simplex.inc.php -- PDG 2015-11-14
|
||||||
$descr = rrdtool_escape(short_hrDeviceDescr($proc['processor_descr']), 28);
|
$descr = rrdtool_escape(short_hrDeviceDescr($proc['processor_descr']), 28);
|
||||||
|
|
||||||
$colour_line = 'cc0000';
|
$colour_line = 'cc0000';
|
||||||
|
@ -19,7 +19,7 @@ $rrd_options .= ' AREA:sensor_diff#c5c5c5::STACK';
|
|||||||
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape($sensor['sensor_descr'], 21)."'";
|
$rrd_options .= " LINE1.5:sensor#cc0000:'".rrdtool_escape($sensor['sensor_descr'], 21)."'";
|
||||||
$rrd_options .= ' GPRINT:sensor_min:MIN:%4.1lfC';
|
$rrd_options .= ' GPRINT:sensor_min:MIN:%4.1lfC';
|
||||||
$rrd_options .= ' GPRINT:sensor:LAST:%4.1lfC';
|
$rrd_options .= ' GPRINT:sensor:LAST:%4.1lfC';
|
||||||
$rrd_options .= ' GPRINT:sensor_max:MAX:%4.1lfC\\\\l';
|
$rrd_options .= ' GPRINT:sensor_max:MAX:%4.1lfC\\l';
|
||||||
|
|
||||||
if (is_numeric($sensor['sensor_limit'])) {
|
if (is_numeric($sensor['sensor_limit'])) {
|
||||||
$rrd_options .= ' HRULE:'.$sensor['sensor_limit'].'#999999::dashes';
|
$rrd_options .= ' HRULE:'.$sensor['sensor_limit'].'#999999::dashes';
|
||||||
|
@ -280,7 +280,8 @@ function rrdtool_lastupdate($filename, $options){
|
|||||||
|
|
||||||
function rrdtool_escape($string, $maxlength=null){
|
function rrdtool_escape($string, $maxlength=null){
|
||||||
$result = shorten_interface_type($string);
|
$result = shorten_interface_type($string);
|
||||||
$result = str_replace('%', '%%', $result);
|
$result = str_replace("'", '', $result); # remove quotes
|
||||||
|
$result = str_replace('%', '%%', $result); # double percent signs
|
||||||
if (is_numeric($maxlength)) {
|
if (is_numeric($maxlength)) {
|
||||||
$extra = substr_count($string, ':', 0, $maxlength);
|
$extra = substr_count($string, ':', 0, $maxlength);
|
||||||
$result = substr(str_pad($result, $maxlength), 0, ($maxlength + $extra));
|
$result = substr(str_pad($result, $maxlength), 0, ($maxlength + $extra));
|
||||||
@ -289,7 +290,7 @@ function rrdtool_escape($string, $maxlength=null){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = str_replace(':', '\:', $result);
|
$result = str_replace(':', '\:', $result); # escape colons
|
||||||
return $result.' ';
|
return $result.' ';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user