smalle fix + cleaning up of unused old code

git-svn-id: http://www.observium.org/svn/observer/trunk@1200 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-06-18 13:24:32 +00:00
parent f67a5d5d77
commit 3a13565b2a
6 changed files with 1 additions and 1296 deletions

View File

@@ -22,7 +22,7 @@ if(mysql_result(mysql_query("SELECT count(current_id) from current WHERE device_
$current_year = "graph.php?id=" . $current['current_id'] . "&type=current&from=$year&to=$now&width=300&height=100";
$current_minigraph = "<img src='graph.php?id=" . $current['current_id'] . "&type=current&from=$day&to=$now&width=80&height=20&bg=$graph_colour' align='absmiddle'>";
$current_link = "<a href='/device/".$device['device_id']."/health/currentuencies/' onmouseover=\"return ";
$current_link = "<a href='/device/".$device['device_id']."/health/current/' onmouseover=\"return ";
$current_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$current['current_descr'];
$current_link .= "</div><div style=\'width: 750px\'><img src=\'$current_day\'><img src=\'$current_week\'><img src=\'$current_month\'><img src=\'$current_year\'></div>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";

View File

@@ -1,466 +0,0 @@
<?php
include("graphing/screenos.php");
include("graphing/fortigate.php");
include("graphing/windows.php");
include("graphing/unix.php");
function graph_multi_bits_trio ($ports, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') {
global $config, $installdir;
$options = " --alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($height < "99") { $options .= " --only-graph"; }
$i = 1;
foreach(explode(",", $ports[0]) as $ifid) {
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
$int = mysql_fetch_row($query);
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
if(strstr($inverse, "a")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
$options .= " DEF:inoctets" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$in."OCTETS:AVERAGE";
$options .= " DEF:outoctets" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$out."OCTETS:AVERAGE";
$in_thing .= $seperator . "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
$out_thing .= $seperator . "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF";
$pluses .= $plus;
$seperator = ",";
$plus = ",+";
$i++;
}
}
unset($seperator); unset($plus);
foreach(explode(",", $ports[1]) as $ifid) {
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
$int = mysql_fetch_row($query);
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
if(strstr($inverse, "b")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
$options .= " DEF:inoctetsb" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$in."OCTETS:AVERAGE";
$options .= " DEF:outoctetsb" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$out."OCTETS:AVERAGE";
$in_thingb .= $seperator . "inoctetsb" . $i . ",UN,0," . "inoctetsb" . $i . ",IF";
$out_thingb .= $seperator . "outoctetsb" . $i . ",UN,0," . "outoctetsb" . $i . ",IF";
$plusesb .= $plus;
$seperator = ",";
$plus = ",+";
$i++;
}
}
unset($seperator); unset($plus);
foreach(explode(",", $ports[2]) as $ifid) {
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
$int = mysql_fetch_row($query);
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
if(strstr($inverse, "c")) { $in = "OUT"; $out = "IN"; } else { $in = "IN"; $out = "OUT"; }
$options .= " DEF:inoctetsc" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$in."OCTETS:AVERAGE";
$options .= " DEF:outoctetsc" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:".$out."OCTETS:AVERAGE";
$in_thingc .= $seperator . "inoctetsc" . $i . ",UN,0," . "inoctetsc" . $i . ",IF";
$out_thingc .= $seperator . "outoctetsc" . $i . ",UN,0," . "outoctetsc" . $i . ",IF";
$plusesc .= $plus;
$seperator = ",";
$plus = ",+";
$i++;
}
}
$options .= " CDEF:inoctets=" . $in_thing . $pluses;
$options .= " CDEF:outoctets=" . $out_thing . $pluses;
$options .= " CDEF:inoctetsb=" . $in_thingb . $plusesb;
$options .= " CDEF:outoctetsb=" . $out_thingb . $plusesb;
$options .= " CDEF:inoctetsc=" . $in_thingc . $plusesc;
$options .= " CDEF:outoctetsc=" . $out_thingc . $plusesc;
$options .= " CDEF:doutoctets=outoctets,-1,*";
$options .= " CDEF:inbits=inoctets,8,*";
$options .= " CDEF:outbits=outoctets,8,*";
$options .= " CDEF:doutbits=doutoctets,8,*";
$options .= " CDEF:doutoctetsb=outoctetsb,-1,*";
$options .= " CDEF:inbitsb=inoctetsb,8,*";
$options .= " CDEF:outbitsb=outoctetsb,8,*";
$options .= " CDEF:doutbitsb=doutoctetsb,8,*";
$options .= " CDEF:doutoctetsc=outoctetsc,-1,*";
$options .= " CDEF:inbitsc=inoctetsc,8,*";
$options .= " CDEF:outbitsc=outoctetsc,8,*";
$options .= " CDEF:doutbitsc=doutoctetsc,8,*";
$options .= " CDEF:inbits_tot=inbits,inbitsb,inbitsc,+,+";
$options .= " CDEF:outbits_tot=outbits,outbitsb,outbitsc,+,+";
$options .= " CDEF:inbits_stot=inbitsc,inbitsb,+";
$options .= " CDEF:outbits_stot=outbitsc,outbitsb,+";
$options .= " CDEF:doutbits_stot=outbits_stot,-1,*";
$options .= " CDEF:doutbits_tot=outbits_tot,-1,*";
$options .= " CDEF:nothing=outbits_tot,outbits_tot,-";
if($legend == "no") {
$options .= " AREA:inbits_tot#cdeb8b:";
$options .= " AREA:doutbits_tot#cdeb8b:";
$options .= " LINE1.25:inbits_tot#aacc77:";
$options .= " LINE1.25:doutbits_tot#aacc88:";
$options .= " AREA:inbits_stot#c3d9ff:";
$options .= " AREA:doutbits_stot#c3d9ff:";
$options .= " LINE1:inbits_stot#b3a9cf:";
$options .= " LINE1:doutbits_stot#b3a9cf:";
$options .= " AREA:inbitsc#ffcc99:";
$options .= " AREA:doutbitsc#ffcc99:";
$options .= " LINE1.25:inbitsc#ddaa88";
$options .= " LINE1.25:doutbitsc#ddaa88";
$options .= " LINE1:inbits#006600:";
$options .= " LINE1:doutbits#006600:";
$options .= " LINE1:inbitsb#000099:";
$options .= " LINE1:doutbitsb#000099:";
$options .= " LINE0.5:nothing#555555:";
} else {
$options .= " COMMENT:BPS\ \ \ \ \ \ \ \ \ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Min\ \ \ \ \ \ Max\\\\n";
$options .= " AREA:inbits_tot#cdeb8b:ATM\ \ In\ ";
$options .= " GPRINT:inbits:LAST:%6.2lf%s";
$options .= " GPRINT:inbits:AVERAGE:%6.2lf%s";
$options .= " GPRINT:inbits:MIN:%6.2lf%s";
$options .= " GPRINT:inbits:MAX:%6.2lf%s\\\\l";
$options .= " AREA:doutbits_tot#cdeb8b:";
$options .= " COMMENT:\ \ \ \ \ \ \ Out";
$options .= " GPRINT:outbits:LAST:%6.2lf%s";
$options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
$options .= " GPRINT:outbits:MIN:%6.2lf%s";
$options .= " GPRINT:outbits:MAX:%6.2lf%s\\\\l";
$options .= " LINE1.25:inbits_tot#aacc77:";
$options .= " LINE1.25:doutbits_tot#aacc88:";
$options .= " AREA:inbits_stot#c3d9ff:NGN\ \ In\ ";
$options .= " GPRINT:inbitsb:LAST:%6.2lf%s";
$options .= " GPRINT:inbitsb:AVERAGE:%6.2lf%s";
$options .= " GPRINT:inbitsb:MIN:%6.2lf%s";
$options .= " GPRINT:inbitsb:MAX:%6.2lf%s\\\\l";
$options .= " AREA:doutbits_stot#c3d9ff:";
$options .= " COMMENT:\ \ \ \ \ \ \ Out";
$options .= " GPRINT:outbitsb:LAST:%6.2lf%s";
$options .= " GPRINT:outbitsb:AVERAGE:%6.2lf%s";
$options .= " GPRINT:outbitsb:MIN:%6.2lf%s";
$options .= " GPRINT:outbitsb:MAX:%6.2lf%s\\\\l";
$options .= " LINE1:inbits_stot#b3a9cf:";
$options .= " LINE1:doutbits_stot#b3a9cf:";
$options .= " AREA:inbitsc#ffcc99:Wave\ In\ ";
$options .= " GPRINT:inbitsc:LAST:%6.2lf%s";
$options .= " GPRINT:inbitsc:AVERAGE:%6.2lf%s";
$options .= " GPRINT:inbitsc:MIN:%6.2lf%s";
$options .= " GPRINT:inbitsc:MAX:%6.2lf%s\\\\l";
$options .= " AREA:doutbitsc#ffcc99:";
$options .= " COMMENT:\ \ \ \ \ \ \ Out";
$options .= " GPRINT:outbitsc:LAST:%6.2lf%s";
$options .= " GPRINT:outbitsc:AVERAGE:%6.2lf%s";
$options .= " GPRINT:outbitsc:MIN:%6.2lf%s";
$options .= " GPRINT:outbitsc:MAX:%6.2lf%s\\\\l";
$options .= " LINE1.25:inbitsc#ddaa88";
$options .= " LINE1.25:doutbitsc#ddaa88";
$options .= " LINE1:inbits#006600:";
$options .= " LINE1:doutbits#006600:";
$options .= " LINE1:inbitsb#000099:";
$options .= " LINE1:doutbitsb#000099:";
$options .= " LINE0.5:nothing#555555:";
$options .= " COMMENT:Total\ \ In\ ";
$options .= " GPRINT:inbits_tot:LAST:%6.2lf%s";
$options .= " GPRINT:inbits_tot:AVERAGE:%6.2lf%s";
$options .= " GPRINT:inbits_tot:MIN:%6.2lf%s";
$options .= " GPRINT:inbits_tot:MAX:%6.2lf%s\\\\l";
$options .= " COMMENT:\ \ \ \ \ \ \ Out";
$options .= " GPRINT:outbits_tot:LAST:%6.2lf%s";
$options .= " GPRINT:outbits_tot:AVERAGE:%6.2lf%s";
$options .= " GPRINT:outbits_tot:MIN:%6.2lf%s";
$options .= " GPRINT:outbits_tot:MAX:%6.2lf%s\\\\l";
}
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal"; }
echo($config['rrdtool'] . " graph $graph $options");
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function graph_multi_bits_duo ($ports, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') {
global $config, $installdir;
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height";
$options .= $config['rrdgraph_def_text'];
if($height < "99") { $options .= " --only-graph"; }
$i = 1;
foreach(explode(",", $ports[0]) as $ifid) {
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
$int = mysql_fetch_row($query);
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
$options .= " DEF:inoctets" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:INOCTETS:AVERAGE";
$options .= " DEF:outoctets" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:OUTOCTETS:AVERAGE";
$in_thing .= $seperator . "inoctets" . $i . ",UN,0," . "inoctets" . $i . ",IF";
$out_thing .= $seperator . "outoctets" . $i . ",UN,0," . "outoctets" . $i . ",IF";
$pluses .= $plus;
$seperator = ",";
$plus = ",+";
$i++;
}
}
unset($seperator); unset($plus);
foreach(explode(",", $ports[1]) as $ifid) {
$query = mysql_query("SELECT `ifIndex`, `hostname` FROM `ports` AS I, devices as D WHERE I.interface_id = '" . $ifid . "' AND I.device_id = D.device_id");
$int = mysql_fetch_row($query);
if(is_file($config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd")) {
$options .= " DEF:inoctetsb" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:INOCTETS:AVERAGE";
$options .= " DEF:outoctetsb" . $i . "=" . $config['rrd_dir'] . "/" . $int[1] . "/" . $int[0] . ".rrd:OUTOCTETS:AVERAGE";
$in_thingb .= $seperator . "inoctetsb" . $i . ",UN,0," . "inoctetsb" . $i . ",IF";
$out_thingb .= $seperator . "outoctetsb" . $i . ",UN,0," . "outoctetsb" . $i . ",IF";
$plusesb .= $plus;
$seperator = ",";
$plus = ",+";
$i++;
}
}
if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; }
$options .= " CDEF:".$in."octets=" . $in_thing . $pluses;
$options .= " CDEF:".$out."octets=" . $out_thing . $pluses;
$options .= " CDEF:".$in."octetsb=" . $in_thingb . $plusesb;
$options .= " CDEF:".$out."octetsb=" . $out_thingb . $plusesb;
$options .= " CDEF:doutoctets=outoctets,-1,*";
$options .= " CDEF:inbits=inoctets,8,*";
$options .= " CDEF:outbits=outoctets,8,*";
$options .= " CDEF:doutbits=doutoctets,8,*";
$options .= " CDEF:doutoctetsb=outoctetsb,-1,*";
$options .= " CDEF:inbitsb=inoctetsb,8,*";
$options .= " CDEF:outbitsb=outoctetsb,8,*";
$options .= " CDEF:doutbitsb=doutoctetsb,8,*";
$options .= " CDEF:inbits_tot=inbits,inbitsb,+";
$options .= " CDEF:outbits_tot=outbits,outbitsb,+";
$options .= " CDEF:doutbits_tot=outbits_tot,-1,*";
$options .= " CDEF:nothing=outbits_tot,outbits_tot,-";
if($legend == "no") {
$options .= " AREA:inbits_tot#cdeb8b:";
$options .= " AREA:inbits#ffcc99:";
$options .= " AREA:doutbits_tot#cdeb8b:";
$options .= " AREA:doutbits#ffcc99:";
$options .= " LINE1:inbits#aa9966:";
$options .= " LINE1:doutbits#aa9966:";
$options .= " LINE1:inbitsb#006600:";
$options .= " LINE1:doutbitsb#006600:";
$options .= " LINE1.25:inbits_tot#006600:";
$options .= " LINE1.25:doutbits_tot#006600:";
$options .= " LINE0.5:nothing#555555:";
} else {
$options .= " COMMENT:BPS\ \ \ \ \ \ \ \ \ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Min\ \ \ \ \ \ Max\\\\n";
$options .= " AREA:inbits_tot#cdeb8b:Peering\ In\ ";
$options .= " GPRINT:inbitsb:LAST:%6.2lf%s";
$options .= " GPRINT:inbitsb:AVERAGE:%6.2lf%s";
$options .= " GPRINT:inbitsb:MIN:%6.2lf%s";
$options .= " GPRINT:inbitsb:MAX:%6.2lf%s\\\\l";
$options .= " AREA:doutbits_tot#cdeb8b:";
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Out";
$options .= " GPRINT:outbitsb:LAST:%6.2lf%s";
$options .= " GPRINT:outbitsb:AVERAGE:%6.2lf%s";
$options .= " GPRINT:outbitsb:MIN:%6.2lf%s";
$options .= " GPRINT:outbitsb:MAX:%6.2lf%s\\\\l";
$options .= " AREA:inbits#ffcc99:Transit\ In\ ";
$options .= " GPRINT:inbits:LAST:%6.2lf%s";
$options .= " GPRINT:inbits:AVERAGE:%6.2lf%s";
$options .= " GPRINT:inbits:MIN:%6.2lf%s";
$options .= " GPRINT:inbits:MAX:%6.2lf%s\\\\l";
$options .= " AREA:doutbits#ffcc99:";
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Out";
$options .= " GPRINT:outbits:LAST:%6.2lf%s";
$options .= " GPRINT:outbits:AVERAGE:%6.2lf%s";
$options .= " GPRINT:outbits:MIN:%6.2lf%s";
$options .= " GPRINT:outbits:MAX:%6.2lf%s\\\\l";
$options .= " COMMENT:Total\ \ \ \ \ In\ ";
$options .= " GPRINT:inbits_tot:LAST:%6.2lf%s";
$options .= " GPRINT:inbits_tot:AVERAGE:%6.2lf%s";
$options .= " GPRINT:inbits_tot:MIN:%6.2lf%s";
$options .= " GPRINT:inbits_tot:MAX:%6.2lf%s\\\\l";
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Out";
$options .= " GPRINT:outbits_tot:LAST:%6.2lf%s";
$options .= " GPRINT:outbits_tot:AVERAGE:%6.2lf%s";
$options .= " GPRINT:outbits_tot:MIN:%6.2lf%s";
$options .= " GPRINT:outbits_tot:MAX:%6.2lf%s\\\\l";
$options .= " LINE1:inbits#aa9966:";
$options .= " LINE1:doutbits#aa9966:";
$options .= " LINE1.25:inbitsb#006600:";
$options .= " LINE1.25:doutbitsb#006600:";
$options .= " LINE1.25:inbits_tot#006600:";
$options .= " LINE1.25:doutbits_tot#006600:";
$options .= " LINE0.5:nothing#555555:";
}
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal"; }
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function graph_cbgp_prefixes ($rrd, $graph, $from, $to, $width, $height) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:Accepted=$database:AcceptedPrefixes:AVERAGE";
#$options .= " DEF:Denied=$database:DeniedPrefixes:AVERAGE";
#$options .= " DEF:Advertised=$database:AdvertisedPrefixes:AVERAGE";
#$options .= " DEF:Suppressed=$database:SuppressedPrefixes:AVERAGE";
#$options .= " DEF:Withdrawn=$database:WithdrawnPrefixes:AVERAGE";
#$options .= " CDEF:dAdvertised=Advertised,-1,*";
$options .= " COMMENT:Prefixes\ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\\\\n";
$options .= " AREA:Accepted#eeaaaa:";
$options .= " LINE2:Accepted#cc0000:Accepted\ \ ";
$options .= " GPRINT:Accepted:LAST:%6.2lf%s";
$options .= " GPRINT:Accepted:MIN:%6.2lf%s";
$options .= " GPRINT:Accepted:MAX:%6.2lf%s\\\\l";
#$options .= " AREA:dAdvertised#aaeeaa:";
#$options .= " LINE2:dAdvertised#00cc00:Advertised";
#$options .= " GPRINT:Advertised:LAST:%6.2lf%s";
#$options .= " GPRINT:Advertised:MIN:%6.2lf%s";
#$options .= " GPRINT:Advertised:MAX:%6.2lf%s\\\\l";
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
# echo($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function bgpupdatesgraph ($rrd, $graph , $from, $to, $width, $height) {
global $config, $installdir;
$database = $config['rrd_dir'] . "/" . $rrd;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:in=$database:bgpPeerInUpdates:AVERAGE";
$options .= " DEF:out=$database:bgpPeerOutUpdates:AVERAGE";
$options .= " CDEF:dout=out,-1,*";
$options .= " AREA:in#aa66aa:";
$options .= " COMMENT:Updates\ \ \ \ Current\ \ \ \ \ Average\ \ \ \ \ \ Maximum\\\\n";
$options .= " LINE1.25:in#330033:In\ \ ";
$options .= " GPRINT:in:LAST:%6.2lf%sU/s";
$options .= " GPRINT:in:AVERAGE:%6.2lf%sU/s";
$options .= " GPRINT:in:MAX:%6.2lf%sU/s\\\\n";
$options .= " AREA:dout#FFDD88:";
$options .= " LINE1.25:dout#FF6600:Out\ ";
$options .= " GPRINT:out:LAST:%6.2lf%sU/s";
$options .= " GPRINT:out:AVERAGE:%6.2lf%sU/s";
$options .= " GPRINT:out:MAX:%6.2lf%sU/s\\\\n";
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function graph_cpu_generic_single ($rrd, $graph , $from, $to, $width, $height) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:cpu=$database:cpu:AVERAGE";
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n";
$options .= " AREA:cpu#ffee99: LINE1.25:cpu#aa2200:Load\ %";
$options .= " GPRINT:cpu:LAST:%6.2lf\ GPRINT:cpu:AVERAGE:%6.2lf\ ";
$options .= " GPRINT:cpu:MAX:%6.2lf\ GPRINT:cpu:AVERAGE:%6.2lf\\\\n";
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function graph_adsl_rate ($rrd, $graph, $from, $to, $width, $height) {
global $config, $installdir;
$database = $config['rrd_dir'] . "/" . $rrd;
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:adslAtucCurrAtt=$database:adslAtucCurrAtt:AVERAGE";
$options .= " DEF:adslAturCurrAtt=$database:adslAturCurrAtt:AVERAGE";
$options .= " CDEF:dslAtucCurrAtt=adslAtucCurrAtt,1000,/";
$options .= " CDEF:dslAturCurrAtt=adslAturCurrAtt,1000,/";
$options .= " COMMENT:Bytes\ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n";
$options .= " LINE1.25:adslAtucCurrAtt#aa2200:Up\ \ \ \ ";
$options .= " GPRINT:dslAtucCurrAtt:LAST:%5.0lfk\ GPRINT:dslAtucCurrAtt:AVERAGE:%5.0lfk\ ";
$options .= " GPRINT:dslAtucCurrAtt:MAX:%5.0lfk\ GPRINT:dslAtucCurrAtt:AVERAGE:%5.0lfk\\\\n";
$options .= " LINE1.25:adslAturCurrAtt#22aa00:Down\ \ ";
$options .= " GPRINT:dslAturCurrAtt:LAST:%5.0lfk\ GPRINT:dslAturCurrAtt:AVERAGE:%5.0lfk\ ";
$options .= " GPRINT:dslAturCurrAtt:MAX:%5.0lfk\ GPRINT:dslAturCurrAtt:AVERAGE:%5.0lfk\\\\n";
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function graph_adsl_snr ($rrd, $graph, $from, $to, $width, $height) {
global $config, $installdir;
$database = $config['rrd_dir'] . "/" . $rrd;
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:adslAtucCurrSnr=$database:adslAtucCurrSnr:AVERAGE";
$options .= " DEF:adslAturCurrSnr=$database:adslAturCurrSnr:AVERAGE";
$options .= " CDEF:dslAtucCurrSnr=adslAtucCurrSnr,10,/";
$options .= " CDEF:dslAturCurrSnr=adslAturCurrSnr,10,/";
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n";
$options .= " LINE1.25:dslAtucCurrSnr#aa2200:SNR\ Up\ \ ";
$options .= " GPRINT:dslAtucCurrSnr:LAST:%3.1lfdB GPRINT:dslAtucCurrSnr:AVERAGE:%3.1lfdB\ ";
$options .= " GPRINT:dslAtucCurrSnr:MAX:%3.1lfdB GPRINT:dslAtucCurrSnr:AVERAGE:%3.1lfdB\\\\n";
$options .= " LINE1.25:dslAturCurrSnr#22aa00:SNR\ Down";
$options .= " GPRINT:dslAturCurrSnr:LAST:%3.1lfdB GPRINT:dslAturCurrSnr:AVERAGE:%3.1lfdB\ ";
$options .= " GPRINT:dslAturCurrSnr:MAX:%3.1lfdB GPRINT:dslAturCurrSnr:AVERAGE:%3.1lfdB\\\\n";
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function graph_adsl_atn ($rrd, $graph, $from, $to, $width, $height) {
global $config, $installdir;
$database = $config['rrd_dir'] . "/" . $rrd;
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:adslAtucCurrAtn=$database:adslAtucCurrAtn:AVERAGE";
$options .= " DEF:adslAturCurrAtn=$database:adslAturCurrAtn:AVERAGE";
$options .= " CDEF:dslAtucCurrAtn=adslAtucCurrAtn,10,/";
$options .= " CDEF:dslAturCurrAtn=adslAturCurrAtn,10,/";
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n";
$options .= " LINE1.25:dslAtucCurrAtn#aa2200:Atten\ Up\ \ ";
$options .= " GPRINT:dslAtucCurrAtn:LAST:%3.1lfdB GPRINT:dslAtucCurrAtn:AVERAGE:%3.1lfdb";
$options .= " GPRINT:dslAtucCurrAtn:MAX:%3.1lfdB GPRINT:dslAtucCurrAtn:AVERAGE:%3.1lfdb\\\\n";
$options .= " LINE1.25:dslAturCurrAtn#22aa00:Atten\ Down";
$options .= " GPRINT:dslAturCurrAtn:LAST:%3.1lfdB GPRINT:dslAturCurrAtn:AVERAGE:%3.1lfdb";
$options .= " GPRINT:dslAturCurrAtn:MAX:%3.1lfdB GPRINT:dslAturCurrAtn:AVERAGE:%3.1lfdb\\\\n";
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function cpugraph ($rrd, $graph , $from, $to, $width, $height) {
global $config, $installdir;
$database = $config['rrd_dir'] . "/" . $rrd;
$options = "--alt-autoscale-max -l 0 -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") {$options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:5s=$database:LOAD5S:AVERAGE";
$options .= " DEF:5m=$database:LOAD5M:AVERAGE";
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n";
$options .= " AREA:5m#ffee99: LINE1.25:5m#aa2200:Load\ %";
$options .= " GPRINT:5m:LAST:%6.2lf\ GPRINT:5m:AVERAGE:%6.2lf\ ";
$options .= " GPRINT:5m:MAX:%6.2lf\ GPRINT:5m:AVERAGE:%6.2lf\\\\n";
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function memgraph ($rrd, $graph , $from, $to, $width, $height, $title, $vertical) {
global $config, $installdir;
$database = $config['rrd_dir'] . "/" . $rrd;
$period = $to - $from;
$options = "-l 0 --alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:MEMTOTAL=$database:MEMTOTAL:AVERAGE";
$options .= " DEF:IOFREE=$database:IOFREE:AVERAGE";
$options .= " DEF:IOUSED=$database:IOUSED:AVERAGE";
$options .= " DEF:PROCFREE=$database:PROCFREE:AVERAGE";
$options .= " DEF:PROCUSED=$database:PROCUSED:AVERAGE";
$options .= " CDEF:FREE=IOFREE,PROCFREE,+";
$options .= " CDEF:USED=IOUSED,PROCUSED,+";
$options .= " COMMENT:Bytes\ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n";
$options .= " AREA:USED#ff6060:";
$options .= " LINE2:USED#cc0000:Used";
$options .= " GPRINT:USED:LAST:%6.2lf%s";
$options .= " GPRINT:USED:MIN:%6.2lf%s";
$options .= " GPRINT:USED:MAX:%6.2lf%s";
$options .= " GPRINT:USED:AVERAGE:%6.2lf%s\\\\l";
$options .= " AREA:FREE#e5e5e5:Free:STACK";
$options .= " GPRINT:FREE:LAST:%6.2lf%s";
$options .= " GPRINT:FREE:MIN:%6.2lf%s";
$options .= " GPRINT:FREE:MAX:%6.2lf%s";
$options .= " GPRINT:FREE:AVERAGE:%6.2lf%s\\\\l";
$options .= " LINE1:MEMTOTAL#000000:";
$thing = shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
?>

View File

@@ -1,65 +0,0 @@
<?php
function graph_fortigate_sessions ($rrd, $graph, $from, $to, $width, $height, $title=NULL, $vertical=NULL) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$imgfile = "graphs/" . "$graph";
$options = "-l 0 -Y -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:sessions=$database:sessions:AVERAGE";
$options .= " COMMENT:Sessions\ \ \ \ \ \ Current\ \ \ \ Average\ \ \ \ Maximum\\\\n";
$options .= " AREA:sessions#ccffcc:";
$options .= " LINE1.25:sessions#006600:Allocated";
$options .= " GPRINT:sessions:LAST:\ %6.0lf";
$options .= " GPRINT:sessions:AVERAGE:\ \ \ %6.0lf";
$options .= " GPRINT:sessions:MAX:\ \ \ %6.0lf\\\\n";
shell_exec($config['rrdtool'] . " graph $imgfile $options");
return $imgfile;
}
function graph_fortigate_cpu ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$imgfile = "graphs/" . "$graph";
$period = $to - $from;
$options = "-l 0 -Y -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:cpu=$database:cpu:AVERAGE";
$options .= " COMMENT:Usage\ \ \ \ \ \ \ Current\ \ \ \ \ Average\ \ \ \ Maximum\\\\n";
$options .= " AREA:cpu#ffcccc:";
$options .= " LINE1.25:cpu#c02020:Average";
$options .= " GPRINT:cpu:LAST:\ \ %5.2lf%%";
$options .= " GPRINT:cpu:AVERAGE:\ \ \ %5.2lf%%";
$options .= " GPRINT:cpu:MAX:\ \ \ %5.2lf%%\\\\n";
shell_exec($config['rrdtool'] . " graph $imgfile $options");
return $imgfile;
}
function graph_fortigate_memory ($rrd, $graph, $from, $to, $width, $height, $title=NULL, $vertical=NULL) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$imgfile = "graphs/" . "$graph";
$options = "-l 0 -Y -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:mem=$database:mem:AVERAGE";
$options .= " DEF:kcap=$database:memcapacity:AVERAGE";
$options .= " CDEF:used=kcap,1024,*,100,/,mem,*";
$options .= " CDEF:cap=kcap,1024,*";
$options .= " COMMENT:Memory\ \ \ \ \ \ \ \ Current\ \ \ \ \ Average\ \ \ \ Maximum\\\\n";
$options .= " AREA:used#ffcccc";
$options .= " LINE1.25:used#cc0000:Used\ \ \ \ \ ";
$options .= " GPRINT:used:MAX:%6.2lf%sB";
$options .= " GPRINT:used:AVERAGE:\ %6.2lf%sB";
$options .= " GPRINT:used:MAX:\ %6.2lf%sB\\\\n";
$options .= " LINE1.25:cap#0000cc:Total\ \ \ ";
$options .= " GPRINT:cap:MAX:\ %6.2lf%sB\\\\n";
shell_exec($config['rrdtool'] . " graph $imgfile $options");
return $imgfile;
}
?>

View File

@@ -1,79 +0,0 @@
<?php
function graph_netscreen_sessions ($rrd, $graph, $from, $to, $width, $height, $title=NULL, $vertical=NULL) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$imgfile = "graphs/" . "$graph";
$options = "-l 0 -Y -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:alloc=$database:allocate:AVERAGE";
$options .= " DEF:max=$database:max:AVERAGE";
$options .= " DEF:failed=$database:failed:AVERAGE";
$options .= " COMMENT:Sessions\ \ \ \ \ \ Current\ \ \ \ Average\ \ \ \ Maximum\\\\n";
$options .= " LINE1.25:max#cc0000:Supported";
$options .= " GPRINT:max:MAX:\ %6.0lf\\\\n";
$options .= " LINE1.25:alloc#006600:Allocated";
$options .= " GPRINT:alloc:LAST:\ %6.0lf";
$options .= " GPRINT:alloc:AVERAGE:\ \ \ %6.0lf";
$options .= " GPRINT:alloc:MAX:\ \ \ %6.0lf\\\\n";
shell_exec($config['rrdtool'] . " graph $imgfile $options");
return $imgfile;
}
function graph_netscreen_cpu ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$imgfile = "graphs/" . "$graph";
$period = $to - $from;
$options = "-l 0 -Y -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:av=$database:average:AVERAGE";
$options .= " DEF:5m=$database:5min:AVERAGE";
$options .= " COMMENT:Usage\ \ \ \ \ \ \ Current\ \ \ \ \ Average\ \ \ \ Maximum\\\\n";
$options .= " AREA:5m#ffeeaa";
$options .= " LINE1.25:5m#aa2000:5min";
$options .= " GPRINT:5m:LAST:\ \ \ \ \ %5.2lf%%";
$options .= " GPRINT:5m:AVERAGE:\ \ \ %5.2lf%%";
$options .= " GPRINT:5m:MAX:\ \ \ %5.2lf%%\\\\n";
$options .= " LINE1.25:av#2020c0:Average";
$options .= " GPRINT:av:LAST:\ \ %5.2lf%%";
$options .= " GPRINT:av:AVERAGE:\ \ \ %5.2lf%%";
$options .= " GPRINT:av:MAX:\ \ \ %5.2lf%%\\\\n";
shell_exec($config['rrdtool'] . " graph $imgfile $options");
return $imgfile;
}
function graph_netscreen_memory ($rrd, $graph, $from, $to, $width, $height, $title=NULL, $vertical=NULL) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$imgfile = "graphs/" . "$graph";
$options = "-l 0 -Y -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:alloc=$database:allocate:AVERAGE";
$options .= " DEF:left=$database:left:AVERAGE";
$options .= " DEF:frag=$database:frag:AVERAGE";
$options .= " CDEF:total=alloc,left,+";
$options .= " COMMENT:Memory\ \ \ \ \ \ \ \ Current\ \ \ \ \ Average\ \ \ \ Maximum\\\\n";
$options .= " AREA:alloc#ffcccc";
$options .= " LINE1.25:alloc#cc0000:Allocated";
$options .= " GPRINT:alloc:MAX:%6.2lf%sB";
$options .= " GPRINT:alloc:AVERAGE:\ %6.2lf%sB";
$options .= " GPRINT:alloc:MAX:\ %6.2lf%sB\\\\n";
$options .= " LINE1.25:left#006600:Left";
$options .= " GPRINT:left:LAST:\ \ \ \ \ %6.2lf%sB";
$options .= " GPRINT:left:AVERAGE:\ %6.2lf%sB";
$options .= " GPRINT:left:MAX:\ %6.2lf%sB\\\\n";
$options .= " LINE1.25:frag#666600:Fragments";
$options .= " GPRINT:frag:LAST:%6.2lf%sB";
$options .= " GPRINT:frag:AVERAGE:\ %6.2lf%sB";
$options .= " GPRINT:frag:MAX:\ %6.2lf%sB\\\\n";
shell_exec($config['rrdtool'] . " graph $imgfile $options");
return $imgfile;
}
?>

View File

@@ -1,434 +0,0 @@
<?php
function mailerrorgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$period = $to - $from;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$range = $to - $from;
$points_per_sample = 3;
$xpoints = '540';
$step = $range*$points_per_sample/$xpoints;
$database = $config['rrd_dir'] . "/" . $rrd . "-mailstats.rrd";
$options .= " DEF:rejected=$database:reject:AVERAGE";
$options .= " DEF:mrejected=$database:reject:MAX";
$options .= " CDEF:rrejected=rejected,60,*";
$options .= " CDEF:drejected=rejected,UN,0,rejected,IF,$step,*";
$options .= " CDEF:srejected=PREV,UN,drejected,PREV,IF,drejected,+";
$options .= " CDEF:rmrejected=mrejected,60,*";
$options .= " DEF:bounced=$database:bounced:AVERAGE";
$options .= " DEF:mbounced=$database:bounced:MAX";
$options .= " CDEF:rbounced=bounced,60,*";
$options .= " CDEF:dbounced=bounced,UN,0,bounced,IF,$step,*";
$options .= " CDEF:sbounced=PREV,UN,dbounced,PREV,IF,dbounced,+";
$options .= " CDEF:rmbounced=mbounced,60,*";
$options .= " DEF:virus=$database:virus:AVERAGE";
$options .= " DEF:mvirus=$database:virus:MAX";
$options .= " CDEF:rvirus=virus,60,*";
$options .= " CDEF:dvirus=virus,UN,0,virus,IF,$step,*";
$options .= " CDEF:svirus=PREV,UN,dvirus,PREV,IF,dvirus,+";
$options .= " CDEF:rmvirus=mvirus,60,*";
$options .= " DEF:spam=$database:spam:AVERAGE";
$options .= " DEF:mspam=$database:spam:MAX";
$options .= " CDEF:rspam=spam,60,*";
$options .= " CDEF:dspam=spam,UN,0,spam,IF,$step,*";
$options .= " CDEF:sspam=PREV,UN,dspam,PREV,IF,dspam,+";
$options .= " CDEF:rmspam=mspam,60,*";
$options .= " COMMENT:Errors\ \ \ \ \ \ \ Total\ \ \ \ \ \ Average\ \ \ \ \ Maximum\\\\n";
$options .= " LINE1.25:rrejected#cc0000:reject";
$options .= " GPRINT:srejected:MAX:\ %6.0lf";
$options .= " GPRINT:rrejected:AVERAGE:\ \ %5.2lf/min";
$options .= " GPRINT:rmrejected:MAX:\ %5.2lf/min\\\\l";
$options .= " AREA:rbounced#0000cc:bounce";
$options .= " GPRINT:sbounced:MAX:\ %6.0lf";
$options .= " GPRINT:rbounced:AVERAGE:\ \ %5.2lf/min";
$options .= " GPRINT:rmbounced:MAX:\ %5.2lf/min\\\\l";
$options .= " STACK:rvirus#000000:virus\ ";
$options .= " GPRINT:svirus:MAX:\ %6.0lf";
$options .= " GPRINT:rvirus:AVERAGE:\ \ %5.2lf/min";
$options .= " GPRINT:rmvirus:MAX:\ %5.2lf/min\\\\l";
$options .= " STACK:rspam#00cc00:spam\ \ ";
$options .= " GPRINT:sspam:MAX:\ %6.0lf";
$options .= " GPRINT:rspam:AVERAGE:\ \ %5.2lf/min";
$options .= " GPRINT:rmspam:MAX:\ %5.2lf/min\\\\l";
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function mailsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$period = $to - $from;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$range = $to - $from;
$points_per_sample = 3;
$xpoints = '540';
$step = $range*$points_per_sample/$xpoints;
$rrd = $config['rrd_dir'] . "/" . $rrd;
$options .= " DEF:sent=$rrd:sent:AVERAGE";
$options .= " DEF:msent=$rrd:sent:MAX";
$options .= " CDEF:rsent=sent,60,*";
$options .= " CDEF:rmsent=msent,60,*";
$options .= " CDEF:dsent=sent,UN,0,sent,IF,$step,*";
$options .= " CDEF:ssent=PREV,UN,dsent,PREV,IF,dsent,+";
$options .= " DEF:recv=$rrd:rcvd:AVERAGE";
$options .= " DEF:mrecv=$rrd:rcvd:MAX";
$options .= " CDEF:rrecv=recv,60,*";
$options .= " CDEF:rmrecv=mrecv,60,*";
$options .= " CDEF:drecv=recv,UN,0,recv,IF,$step,*";
$options .= " CDEF:srecv=PREV,UN,drecv,PREV,IF,drecv,+";
$options .= " COMMENT:Mails\ \ \ \ \ \ Total\ \ \ \ \ \ \ Average\ \ \ \ \ Maximum\\\\n";
$options .= " AREA:rsent#00c000:sent";
$options .= " LINE1.25:rsent#005000:";
$options .= " GPRINT:ssent:MAX:\ \ %6.0lf";
$options .= " GPRINT:rsent:AVERAGE:\ \ %5.2lf/min";
$options .= " GPRINT:rmsent:MAX:\ %5.2lf/min\\\\l";
$options .= " LINE1.25:rrecv#cc0000:rcvd";
$options .= " GPRINT:srecv:MAX:\ \ %6.0lf";
$options .= " GPRINT:rrecv:AVERAGE:\ \ %5.2lf/min";
$options .= " GPRINT:rmrecv:MAX:\ %5.2lf/min\\\\l";
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function memgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:atotalswap=$database:totalswap:AVERAGE";
$options .= " DEF:aavailswap=$database:availswap:AVERAGE";
$options .= " DEF:atotalreal=$database:totalreal:AVERAGE";
$options .= " DEF:aavailreal=$database:availreal:AVERAGE";
$options .= " DEF:atotalfree=$database:totalfree:AVERAGE";
$options .= " DEF:ashared=$database:shared:AVERAGE";
$options .= " DEF:abuffered=$database:buffered:AVERAGE";
$options .= " DEF:acached=$database:cached:AVERAGE";
$options .= " CDEF:totalswap=atotalswap,1024,*";
$options .= " CDEF:availswap=aavailswap,1024,*";
$options .= " CDEF:totalreal=atotalreal,1024,*";
$options .= " CDEF:availreal=aavailreal,1024,*";
$options .= " CDEF:totalfree=atotalfree,1024,*";
$options .= " CDEF:shared=ashared,1024,*";
$options .= " CDEF:buffered=abuffered,1024,*";
$options .= " CDEF:cached=acached,1024,*";
$options .= " CDEF:usedreal=totalreal,availreal,-";
$options .= " CDEF:usedswap=totalswap,availswap,-";
$options .= " CDEF:cusedswap=usedswap,-1,*";
$options .= " CDEF:cdeftot=availreal,shared,buffered,usedreal,cached,usedswap,+,+,+,+,+";
$options .= " COMMENT:Bytes\ \ \ \ \ \ \ Current\ \ \ \ Average\ \ \ \ \ Maximum\\n";
$options .= " LINE1:usedreal#d0b080:";
$options .= " AREA:usedreal#f0e0a0:used";
$options .= " GPRINT:usedreal:LAST:\ \ \ %7.2lf%sB";
$options .= " GPRINT:usedreal:AVERAGE:%7.2lf%sB";
$options .= " GPRINT:usedreal:MAX:%7.2lf%sB\\\\n";
$options .= " STACK:availreal#e5e5e5:free";
$options .= " GPRINT:availreal:LAST:\ \ \ %7.2lf%sB";
$options .= " GPRINT:availreal:AVERAGE:%7.2lf%sB";
$options .= " GPRINT:availreal:MAX:%7.2lf%sB\\\\n";
$options .= " LINE1:usedreal#d0b080:";
$options .= " AREA:shared#afeced::";
$options .= " AREA:buffered#cc0000::STACK";
$options .= " AREA:cached#ffaa66::STACK";
$options .= " LINE1.25:shared#008fea:shared";
$options .= " GPRINT:shared:LAST:\ %7.2lf%sB";
$options .= " GPRINT:shared:AVERAGE:%7.2lf%sB";
$options .= " GPRINT:shared:MAX:%7.2lf%sB\\\\n";
$options .= " LINE1.25:buffered#ff1a00:buffers:STACK";
$options .= " GPRINT:buffered:LAST:%7.2lf%sB";
$options .= " GPRINT:buffered:AVERAGE:%7.2lf%sB";
$options .= " GPRINT:buffered:MAX:%7.2lf%sB\\\\n";
$options .= " LINE1.25:cached#ea8f00:cached:STACK";
$options .= " GPRINT:cached:LAST:\ %7.2lf%sB";
$options .= " GPRINT:cached:AVERAGE:%7.2lf%sB";
$options .= " GPRINT:cached:MAX:%7.2lf%sB\\\\n";
$options .= " LINE1:totalreal#050505:";
$options .= " AREA:cusedswap#C3D9FF:swap";
$options .= " LINE1.25:cusedswap#356AA0:";
$options .= " GPRINT:usedswap:LAST:\ \ \ %7.2lf%sB";
$options .= " GPRINT:usedswap:AVERAGE:%7.2lf%sB";
$options .= " GPRINT:usedswap:MAX:%7.2lf%sB\\\\n";
$options .= " LINE1:totalreal#050505:total";
$options .= " GPRINT:totalreal:AVERAGE:\ \ %7.2lf%sB";
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function loadgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$period = $to - $from;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:1min=$database:1min:AVERAGE";
$options .= " DEF:5min=$database:5min:AVERAGE";
$options .= " DEF:15min=$database:15min:AVERAGE";
$options .= " CDEF:a=1min,100,/";
$options .= " CDEF:b=5min,100,/";
$options .= " CDEF:c=15min,100,/";
$options .= " CDEF:cdefd=a,b,c,+,+";
$options .= " COMMENT:Load\ Average\ \ Current\ \ \ \ Average\ \ \ \ Maximum\\\\n";
$options .= " AREA:a#ffeeaa:1\ Min:";
$options .= " LINE1:a#c5aa00:";
$options .= " GPRINT:a:LAST:\ \ \ \ %7.2lf";
$options .= " GPRINT:a:AVERAGE:\ \ %7.2lf";
$options .= " GPRINT:a:MAX:\ \ %7.2lf\\\\n";
$options .= " LINE1.25:b#ea8f00:5\ Min:";
$options .= " GPRINT:b:LAST:\ \ \ \ %7.2lf";
$options .= " GPRINT:b:AVERAGE:\ \ %7.2lf";
$options .= " GPRINT:b:MAX:\ \ %7.2lf\\\\n";
$options .= " LINE1.25:c#cc0000:15\ Min";
$options .= " GPRINT:c:LAST:\ \ \ %7.2lf";
$options .= " GPRINT:c:AVERAGE:\ \ %7.2lf";
$options .= " GPRINT:c:MAX:\ \ %7.2lf\\\\n";
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function usersgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$period = $to - $from;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:users=$database:users:AVERAGE";
$options .= " COMMENT:Users\ \ \ \ \ \ \ Cur\ \ \ \ \ Ave\ \ \ \ \ \ Min\ \ \ \ \ Max\\\\n";
$options .= " AREA:users#CDEB8B:";
$options .= " LINE1.25:users#008C00:\ ";
$options .= " GPRINT:users:LAST:\ \ \ \ %6.2lf";
$options .= " GPRINT:users:AVERAGE:%6.2lf";
$options .= " GPRINT:users:MIN:%6.2lf";
$options .= " GPRINT:users:MAX:%6.2lf\\\\n";
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function procsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$period = $to - $from;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:procs=$database:procs:AVERAGE";
$options .= " COMMENT:Processes\ \ \ \ Cur\ \ \ \ \ Ave\ \ \ \ \ \ Min\ \ \ \ \ Max\\\\n";
$options .= " AREA:procs#CDEB8B:";
$options .= " LINE1.25:procs#008C00:\ ";
$options .= " GPRINT:procs:LAST:\ \ \ \ %6.2lf";
$options .= " GPRINT:procs:AVERAGE:%6.2lf";
$options .= " GPRINT:procs:MIN:%6.2lf";
$options .= " GPRINT:procs:MAX:%6.2lf\\\\n";
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function cpugraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$period = $to - $from;
$options = "-l 0 --alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:user=$database:user:AVERAGE";
$options .= " DEF:nice=$database:nice:AVERAGE";
$options .= " DEF:system=$database:system:AVERAGE";
$options .= " DEF:idle=$database:idle:AVERAGE";
$options .= " CDEF:total=user,nice,system,idle,+,+,+";
$options .= " CDEF:user_perc=user,total,/,100,*";
$options .= " CDEF:nice_perc=nice,total,/,100,*";
$options .= " CDEF:system_perc=system,total,/,100,*";
$options .= " CDEF:idle_perc=idle,total,/,100,*";
$options .= " COMMENT:Usage\ \ \ \ \ \ \ Current\ \ \ \ \ Average\ \ \ \ Maximum\\\\n";
$options .= " AREA:user_perc#c02020:user";
$options .= " GPRINT:user_perc:LAST:\ \ \ \ \ %5.2lf%%";
$options .= " GPRINT:user_perc:AVERAGE:\ \ \ %5.2lf%%";
$options .= " GPRINT:user_perc:MAX:\ \ \ %5.2lf%%\\\\n";
$options .= " AREA:nice_perc#008f00:nice:STACK";
$options .= " GPRINT:nice_perc:LAST:\ \ \ \ \ %5.2lf%%";
$options .= " GPRINT:nice_perc:AVERAGE:\ \ \ %5.2lf%%";
$options .= " GPRINT:nice_perc:MAX:\ \ \ %5.2lf%%\\\\n";
$options .= " AREA:system_perc#ea8f00:system:STACK";
$options .= " GPRINT:system_perc:LAST:\ \ \ %5.2lf%%";
$options .= " GPRINT:system_perc:AVERAGE:\ \ \ %5.2lf%%";
$options .= " GPRINT:system_perc:MAX:\ \ \ %5.2lf%%\\\\n";
$options .= " AREA:idle_perc#f5f5e5:idle:STACK";
$options .= " GPRINT:idle_perc:LAST:\ \ \ \ \ %5.2lf%%";
$options .= " GPRINT:idle_perc:AVERAGE:\ \ \ %5.2lf%%";
$options .= " GPRINT:idle_perc:MAX:\ \ \ %5.2lf%%\\\\n";
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function couriergraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$period = $to - $from;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$points_per_sample = 3;
$range = $to - $from;
$options .= " DEF:pop3d_login=$database:pop3:AVERAGE";
$options .= " DEF:mpop3d_login=$database:pop3:MAX";
$options .= " DEF:imapd_login=$database:imap:AVERAGE";
$options .= " DEF:mimapd_login=$database:imap:MAX";
$options .= " CDEF:rpop3d_login=pop3d_login,60,*";
$options .= " CDEF:vpop3d_login=pop3d_login,UN,0,pop3d_login,IF,$range,*";
$options .= " CDEF:rmpop3d_login=mpop3d_login,60,*";
$options .= " CDEF:rimapd_login=imapd_login,60,*";
$options .= " CDEF:vimapd_login=imapd_login,UN,0,imapd_login,IF,$range,*";
$options .= " CDEF:rmimapd_login=mimapd_login,60,*";
$options .= " DEF:pop3d_ssl_login=$database:pop3ssl:AVERAGE";
$options .= " DEF:mpop3d_ssl_login=$database:pop3ssl:MAX";
$options .= " DEF:imapd_ssl_login=$database:imapssl:AVERAGE";
$options .= " DEF:mimapd_ssl_login=$database:imapssl:MAX";
$options .= " CDEF:rpop3d_ssl_login=pop3d_ssl_login,60,*";
$options .= " CDEF:vpop3d_ssl_login=pop3d_ssl_login,UN,0,pop3d_ssl_login,IF,$range,*";
$options .= " CDEF:rmpop3d_ssl_login=mpop3d_ssl_login,60,*";
$options .= " CDEF:rimapd_ssl_login=imapd_ssl_login,60,*";
$options .= " CDEF:rmimapd_ssl_login=mimapd_ssl_login,60,*";
$options .= " CDEF:vimapd_ssl_login=imapd_ssl_login,UN,0,imapd_ssl_login,IF,$range,*";
$options .= " COMMENT:Logins\ \ \ \ \ \ \ \ \ Total\ \ \ \ Average\ \ \ \ Maximum\\\\n";
$options .= " LINE1.25:rpop3d_login#BB0000:pop3";
$options .= " GPRINT:vpop3d_login:AVERAGE:\ \ \ \ \ %6.0lf";
$options .= " GPRINT:rpop3d_login:AVERAGE:%5.2lf/min";
$options .= " GPRINT:rmpop3d_login:MAX:%5.2lf/min\\\\l";
$options .= " LINE1.25:rimapd_login#009900:imap";
$options .= " GPRINT:vimapd_login:AVERAGE:\ \ \ \ \ %6.0lf";
$options .= " GPRINT:rimapd_login:AVERAGE:%5.2lf/min";
$options .= " GPRINT:rmimapd_login:MAX:%5.2lf/min\\\\l";
$options .= " LINE1.25:rpop3d_ssl_login#000000:pop3-ssl";
$options .= " GPRINT:vpop3d_ssl_login:AVERAGE:\ %6.0lf";
$options .= " GPRINT:rpop3d_ssl_login:AVERAGE:%5.2lf/min";
$options .= " GPRINT:rmpop3d_ssl_login:MAX:%5.2lf/min\\\\l";
$options .= " LINE1.25:rimapd_ssl_login#000099:imap-ssl";
$options .= " GPRINT:vimapd_ssl_login:AVERAGE:\ %6.0lf";
$options .= " GPRINT:rimapd_ssl_login:AVERAGE:%5.2lf/min";
$options .= " GPRINT:rmimapd_ssl_login:MAX:%5.2lf/min\\\\l";
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function apachehitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:hits=$database:hits:AVERAGE";
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ Current\ \ \ \ \ Average\ \ \ \ \ Maximum\\\\n";
$options .= " AREA:hits#ff9933:";
$options .= " LINE1.25:hits#FF6600:Hits";
$options .= " GPRINT:hits:LAST:\ %6.2lf/sec";
$options .= " GPRINT:hits:AVERAGE:%6.2lf/sec";
$options .= " GPRINT:hits:MAX:%6.2lf/sec\\\\n";
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function unixfsgraph ($id, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024 -l 0";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$hostname = gethostbyid($device);
$iter = "1";
$sql = mysql_query("SELECT * FROM storage where storage_id = '$id'");
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Size\ \ \ \ \ \ Used\ \ \ \ %age\l";
while($fs = mysql_fetch_array($sql)) {
$hostname = gethostbyid($fs['device_id']);
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
$descr = str_pad($fs[storage_descr], 14);
$descr = substr($descr,0,14);
$text = str_replace("/", "_", $fs['storage_descr']);
$rrd = $config['rrd_dir'] . "/$hostname/storage-$text.rrd";
$options .= " DEF:$fs[storage_id]=$rrd:used:AVERAGE";
$options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
$options .= " DEF:$fs[storage_id]p=$rrd:perc:AVERAGE";
$options .= " LINE1.25:$fs[storage_id]p#" . $colour . ":'$descr'";
$options .= " GPRINT:$fs[storage_id]s:LAST:%6.2lf%SB";
$options .= " GPRINT:$fs[storage_id]:LAST:%6.2lf%SB";
$options .= " GPRINT:$fs[storage_id]p:LAST:%5.2lf%%\\\\l";
$iter++;
}
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function unixfsgraph_dev ($device, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -b 1024 -l 0";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$hostname = gethostbyid($device);
$iter = "1";
$sql = mysql_query("SELECT * FROM storage where device_id = '$device'");
$options .= "COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Size\ \ \ \ \ \ Used\ \ \ \ %age\l";
while($fs = mysql_fetch_array($sql)) {
if($iter=="1") {$colour="CC0000";} elseif($iter=="2") {$colour="008C00";} elseif($iter=="3") {$colour="4096EE";
} elseif($iter=="4") {$colour="73880A";} elseif($iter=="5") {$colour="D01F3C";} elseif($iter=="6") {$colour="36393D";
} elseif($iter=="7") {$colour="FF0084"; $iter = "0"; }
$descr = str_pad($fs[storage_descr], 14);
$descr = substr($descr,0,14);
$text = str_replace("/", "_", $fs['storage_descr']);
$rrd = $config['rrd_dir'] . "/$hostname/storage-$text.rrd";
$options .= " DEF:$fs[storage_id]=$rrd:used:AVERAGE";
$options .= " DEF:$fs[storage_id]s=$rrd:size:AVERAGE";
$options .= " DEF:$fs[storage_id]p=$rrd:perc:AVERAGE";
$options .= " LINE1.25:$fs[storage_id]p#" . $colour . ":'$descr'";
$options .= " GPRINT:$fs[storage_id]s:LAST:%6.2lf%SB";
$options .= " GPRINT:$fs[storage_id]:LAST:%6.2lf%SB";
$options .= " GPRINT:$fs[storage_id]p:LAST:%5.2lf%%\\\\l";
$iter++;
}
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}
function apachebitsgraphUnix ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
global $config;
$database = $config['rrd_dir'] . "/" . $rrd;
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height -l 0";
$options .= $config['rrdgraph_def_text'];
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
$options .= " DEF:bits=$database:bits:AVERAGE";
$options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ \ \ Current\ \ \ \ \ Average\ \ \ \ \ Maximum\\\\n";
$options .= " AREA:bits#cccc00:";
$options .= " LINE1.25:bits#9900:Bits";
$options .= " GPRINT:bits:LAST:\ %6.2lf/sec";
$options .= " GPRINT:bits:AVERAGE:%6.2lf/sec";
$options .= " GPRINT:bits:MAX:%6.2lf/sec\\\\n";
shell_exec($config['rrdtool'] . " graph $graph $options");
return $graph;
}

View File

@@ -1,251 +0,0 @@
<?php
function memgraphWin ($rrd, $graph, $from="-2d")
{
$database = "rrd/" . $rrd;
$imgfile = "graphs/" . "$graph";
$opts = array (
"--start",
$from,
"-v MB",
"-b 1000",
"--rigid",
"--title", "Memory Usage",
"--alt-autoscale-max",
"-l 0",
"--width", "335", "--height", "100",
"DEF:totalswap=$database:totalswap:AVERAGE",
"DEF:availswap=$database:availswap:AVERAGE",
"DEF:totalreal=$database:totalreal:AVERAGE",
"DEF:availreal=$database:availreal:AVERAGE",
"DEF:totalfree=$database:totalfree:AVERAGE",
"DEF:shared=$database:shared:AVERAGE",
"DEF:buffered=$database:buffered:AVERAGE",
"DEF:cached=$database:cached:AVERAGE",
"CDEF:usedreal=totalreal,availreal,-",
"CDEF:usedswap=totalswap,availswap,-",
"CDEF:cdeftot=availreal,shared,buffered,usedreal,cached,usedswap,+,+,+,+,+",
"AREA:usedreal#ee8000:used",
"GPRINT:usedreal:LAST: Cur\:%8.2lf %s",
"GPRINT:usedreal:AVERAGE: Avg\:%8.2lf %s",
"GPRINT:usedreal:MAX: Max\:%8.2lf %s\\n",
"STACK:shared#ec9900:shared",
"GPRINT:shared:LAST: Cur\:%8.2lf %s",
"GPRINT:shared:AVERAGE: Avg\:%8.2lf %s",
"GPRINT:shared:MAX: Max\:%8.2lf %s\\n",
"STACK:availreal#eacc00:free",
"GPRINT:availreal:LAST: Cur\:%8.2lf %s",
"GPRINT:availreal:AVERAGE: Avg\:%8.2lf %s",
"GPRINT:availreal:MAX: Max\:%8.2lf %s\\n",
"STACK:buffered#cc0000:buffers",
"GPRINT:buffered:LAST:Cur\:%8.2lf %s",
"GPRINT:buffered:AVERAGE: Avg\:%8.2lf %s",
"GPRINT:buffered:MAX: Max\:%8.2lf %s\\n",
"STACK:cached#9fa4ee:cached",
"GPRINT:cached:LAST: Cur\:%8.2lf %s",
"GPRINT:cached:AVERAGE: Avg\:%8.2lf %s",
"GPRINT:cached:MAX: Max\:%8.2lf %s\\n",
"STACK:usedswap#afeced:swap",
"GPRINT:usedswap:LAST: Cur\:%8.2lf %s",
"GPRINT:usedswap:AVERAGE: Avg\:%8.2lf %s",
"GPRINT:usedswap:MAX: Max\:%8.2lf %s",
"LINE1:totalreal#050505:total");
$ret = rrd_graph("$imgfile", $opts, count($opts));
if( !is_array($ret) ) {
$err = rrd_error();
echo "rrd_graph() ERROR: $err\n";
return FALSE;
} else {
return $imgfile;
}
}
function loadgraphWin ($rrd, $graph, $from="-2d") {
$database = "rrd/" . $rrd;
$imgfile = "graphs/" . "$graph";
$opts = array(
"--title", "Load Averages",
"--start",
$from,
"-v Load",
"--rigid",
"--alt-autoscale-max",
"-l 0",
"--width", "335", "--height", "100",
"DEF:1min=$database:1min:AVERAGE",
"DEF:5min=$database:5min:AVERAGE",
"DEF:15min=$database:15min:AVERAGE",
"CDEF:a=1min,100,/",
"CDEF:b=5min,100,/",
"CDEF:c=15min,100,/",
"CDEF:cdefd=a,b,c,+,+",
"AREA:a#eacc00:1 Minute:",
"LINE1:a#c5aa00:",
"GPRINT:a:LAST: Cur\:%8.2lf %s",
"GPRINT:a:AVERAGE: Ave\:%8.2lf %s",
"GPRINT:a:MAX: Max\:%8.2lf %s\\n",
"LINE1.5:b#ea8f00:5 Minute:",
"GPRINT:b:LAST: Cur\:%8.2lf %s",
"GPRINT:b:AVERAGE: Ave\:%8.2lf %s",
"GPRINT:b:MAX: Max\:%8.2lf %s\\n",
"LINE1.5:c#cc0000:15 Minute",
"GPRINT:c:LAST:Cur\:%8.2lf %s",
"GPRINT:c:AVERAGE: Ave\:%8.2lf %s",
"GPRINT:c:MAX: Max\:%8.2lf %s\\n");
$ret = rrd_graph("$imgfile", $opts, count($opts));
if( !is_array($ret) ) {
$err = rrd_error();
echo "rrd_graph() ERROR: $err\n";
return FALSE;
} else {
return $imgfile;
}
}
function usersgraphWin ($rrd, $graph, $from="-2d") {
$database = "rrd/" . $rrd;
$imgfile = "graphs/" . "$graph";
$opts = array(
"--title", "Logged on Users",
"--vertical-label", "Users",
"-l 0",
"--width", "335", "--height", "100",
"--start",
$from,
"DEF:users=$database:users:AVERAGE",
"AREA:users#eacc00:users",
"LINE1.5:users#cc0000:",
"GPRINT:users:LAST: Cur\:%3.0lf %s",
"GPRINT:users:AVERAGE: Avg\:%3.0lf %s",
"GPRINT:users:MIN: Min\:%3.0lf %s",
"GPRINT:users:MAX: Max\:%3.0lf %s\\n");
$ret = rrd_graph("$imgfile", $opts, count($opts));
if( !is_array($ret) ) {
$err = rrd_error();
echo "rrd_graph() ERROR: $err\n";
return FALSE;
} else {
return $imgfile;
}
}
function procsgraphWin ($rrd, $graph, $from="-2d") {
$database = "rrd/" . $rrd;
$imgfile = "graphs/" . "$graph";
$opts = array(
"-v # Processes",
"--title", "Running Processes",
"--vertical-label", "procs",
"-l 0",
"--width", "335", "--height", "100",
"--start",
$from,
"DEF:procs=$database:procs:AVERAGE",
"AREA:procs#eacc00:Processes",
"LINE1.5:procs#cc0000:",
"GPRINT:procs:LAST: Cur\:%3.0lf %s",
"GPRINT:procs:AVERAGE: Avg\:%3.0lf %s",
"GPRINT:procs:MIN: Min\:%3.0lf %s",
"GPRINT:procs:MAX: Max\:%3.0lf %s\\n");
$ret = rrd_graph("$imgfile", $opts, count($opts));
if( !is_array($ret) ) {
$err = rrd_error();
echo "rrd_graph() ERROR: $err\n";
return FALSE;
} else {
return $imgfile;
}
}
function cpugraphWin ($rrd, $graph, $from="-2d") {
$database = "rrd/" . $rrd;
$imgfile = "graphs/" . "$graph";
$opts = array(
"-v CPU Utilization",
"--title", "Processor Usage",
"-u 100",
"--rigid",
"--vertical-label", "Load (%)",
"-l 0",
"--width", "335", "--height", "100",
"--start",
$from,
"DEF:user=$database:user:AVERAGE",
"DEF:nice=$database:nice:AVERAGE",
"DEF:system=$database:system:AVERAGE",
"DEF:idle=$database:idle:AVERAGE",
"CDEF:total=user,nice,system,idle,+,+,+",
"CDEF:user_perc=user,total,/,100,*",
"CDEF:nice_perc=nice,total,/,100,*",
"CDEF:system_perc=system,total,/,100,*",
"CDEF:idle_perc=idle,total,/,100,*",
"AREA:user_perc#eacc00:user",
"GPRINT:user_perc:LAST: Cur\:%3.0lf%%",
"GPRINT:user_perc:AVERAGE: Avg\:%3.0lf%%",
"GPRINT:user_perc:MAX: Max\:%3.0lf%%\\n",
"AREA:nice_perc#ea8f00:system:STACK",
"GPRINT:nice_perc:LAST:Cur\:%3.0lf%%",
"GPRINT:nice_perc:AVERAGE: Avg\:%3.0lf%%",
"GPRINT:nice_perc:MAX: Max\:%3.0lf%%\\n",
"AREA:system_perc#ff3932:nice:STACK",
"GPRINT:system_perc:LAST: Cur\:%3.0lf%%",
"GPRINT:system_perc:AVERAGE: Avg\:%3.0lf%%",
"GPRINT:system_perc:MAX: Max\:%3.0lf%%\\n",
"AREA:idle_perc#fafdce:idle:STACK",
"GPRINT:idle_perc:LAST: Cur\:%3.0lf%%",
"GPRINT:idle_perc:AVERAGE: Avg\:%3.0lf%%",
"GPRINT:idle_perc:MAX: Max\:%3.0lf%%\\n");
$ret = rrd_graph("$imgfile", $opts, count($opts));
if( !is_array($ret) ) {
$err = rrd_error();
return FALSE;
} else {
return $imgfile;
}
}
function storagegraphWin ($rrd, $graph, $from="-2d", $descr)
{
$database = "rrd/" . $rrd;
$imgfile = "graphs/" . "$graph";
$opts = array (
"--start",
$from,
"-v MB",
"-b 1024",
"--rigid",
"--title", $descr,
"--alt-autoscale-max",
"-l 0",
"--width", "335", "--height", "100",
"DEF:size=$database:size:AVERAGE",
"DEF:used=$database:used:AVERAGE",
"AREA:size#80ee80:Total",
"GPRINT:size:LAST:Cur\:%8.2lf %s",
"GPRINT:size:AVERAGE: Avg\:%8.2lf %s",
"GPRINT:size:MAX: Max\:%8.2lf %s\\n",
"AREA:used#ec9900:Used",
"GPRINT:used:LAST: Cur\:%8.2lf %s",
"GPRINT:used:AVERAGE: Avg\:%8.2lf %s",
"GPRINT:used:MAX: Max\:%8.2lf %s\\n",
"LINE1:size#000000:");
$ret = rrd_graph("$imgfile", $opts, count($opts));
if( !is_array($ret) ) {
$err = rrd_error();
echo "rrd_graph() ERROR: $err\n";
return FALSE;
} else {
return $imgfile;
}
}
?>