<?
echo '<?xml version="1.0" encoding="UTF-8"?>' . "n"; require('sslib.php');
$server = $_GET['server'];
$servers = GetServerList();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<link rel="stylesheet" href="shoutstats.css" type="text/css" media="screen" />
</head>
<body>
<?
// a specific server has been selected
// generate and display the 24 hours server specific graph
$txt_freq = 'hourly';
$rrdgfx=SS_PATH_GFX."/hourly-{$servers[$server]['host']}.{$servers[$server]['port']}.png";
$rrdfile=SS_PATH_RRD."/{$servers[$server]['host']}.{$servers[$server]['port']}.rrd";
exec(SS_RRDTOOL_COMMAND
. " graph $rrdgfx --lazy -l 0 -a PNG DEF:myaudience=$rrdfile:audience:AVERAGE LINE2:myaudience#FF0000"); DisplayGraph($txt_freq, $rrdgfx);
// generate and display the 7 days server specific graph
$txt_freq = 'daily';
$rrdgfx=SS_PATH_GFX."/daily-{$servers[$server]['host']}.{$servers[$server]['port']}.png";
exec(SS_RRDTOOL_COMMAND
. " graph $rrdgfx --lazy -l 0 -a PNG -s e-1w DEF:myaudience=$rrdfile:audience:AVERAGE LINE2:myaudience#FF0000"); DisplayGraph($txt_freq, $rrdgfx);
// generate and display the 5 weeks server specific graph
$txt_freq = 'weekly';
$rrdgfx=SS_PATH_GFX."/weekly-{$servers[$server]['host']}.{$servers[$server]['port']}.png";
exec(SS_RRDTOOL_COMMAND
. " graph $rrdgfx --lazy -l 0 -a PNG -s e-5w DEF:myaudience=$rrdfile:audience:AVERAGE LINE2:myaudience#FF0000"); DisplayGraph($txt_freq, $rrdgfx);
// generate and display the 12 months server specific graph
$txt_freq = 'monthly';
$rrdgfx=SS_PATH_GFX."/monthly-{$servers[$server]['host']}.{$servers[$server]['port']}.png";
exec(SS_RRDTOOL_COMMAND
. " graph $rrdgfx --lazy -l 0 -a PNG -s e-1y DEF:myaudience=$rrdfile:audience:AVERAGE LINE2:myaudience#FF0000"); DisplayGraph($txt_freq, $rrdgfx);
// generate and display the 12 months server specific graph
$txt_freq = 'uptime';
$rrdgfx=SS_PATH_GFX."/uptime-{$servers[$server]['host']}.{$servers[$server]['port']}.png";
exec(SS_RRDTOOL_COMMAND
. ' graph $rrdgfx --start 1183882501 --end 1183896901 --imgformat PNG --lazy -w 700 -h 300 COMMENT:"From 2007-07-08 10:15:01 To 2007-07-08 14:15:01c" COMMENT:"n" --title "eLuna Web Server - Load Average" --vertical-label="" --units-exponent 0 --lower-limit 0 DEF:load_1mn=rrd/01_load/load.rrd:load_1mn:AVERAGE DEF:load_5mn=rrd/01_load/load.rrd:load_5mn:AVERAGE DEF:load_15mn=rrd/01_load/load.rrd:load_15mn:AVERAGE CDEF:mysum=load_1mn,load_5mn,+,load_15mn,+ AREA:load_
1mn#EACC00:" 1mn load average " GPRINT:load_1mn:LAST:"Current: %5.2lf " GPRINT:load_1mn:AVERAGE:"Average: %5.2lf " GPRINT:load_1mn:MAX:"Max: %5.2lfn" STACK:load_5mn#EA8F00:" 5mn load average " GPRINT:load_5mn:LAST:"Current: %5.2lf " GPRINT:load_5mn:AVERAGE:"Average: %5.2lf " GPRINT:load_5mn:MAX:"Max: %5.2lfn" STACK:load_15mn#FF0000:"15mn load average " GPRINT:load_15mn:LAST:"Current: %5.2lf " GPRINT:load_15mn:AVERAGE:"Average: %5.2lf " GPRINT:load_15mn:MAX:"Max: %5.2lfn" LINE1:mysum#000000'); DisplayGraph($txt_freq, $rrdgfx);
// no server has been selected
else:
$rrdexecend = ' ';
$i = 0;
foreach ($servers as $n => $s)
{
$rrdfile = SS_PATH_RRD."/{$s['host']}.{$s['port']}.rrd";
$rrdexecend .= "DEF:myaudience$i=$rrdfile:audience:AVERAGE ";
$rrdexecend .= "CDEF:audience$i=myaudience$i,UN,0,myaudience$i,IF ";
$i++;
}
$rrdexecend .= 'CDEF:mytotal=';
for($i=0; $i<count($servers); $i++)
$rrdexecend .= "audience$i,";
for($i=0; $i<count($servers)-2; $i++)
$rrdexecend .= '+,';
$rrdexecend .= '+ ';
} else {
$rrdexecend .= 'CDEF:mytotal=audience0 ';
}
$rrdexecend .= 'LINE2:mytotal#FF0000';
// generate and display the 24 hours graph
$txt_freq = 'hourly';
$rrdgfx = SS_PATH_GFX.'/hourly-all.png';
$rrdexecstart = SS_RRDTOOL_COMMAND . " graph $rrdgfx --lazy -l 0 -a PNG";
exec($rrdexecstart.$rrdexecend); DisplayGraph($txt_freq, $rrdgfx);
// generate and display the 7 days graph
$txt_freq = 'daily';
$rrdgfx = SS_PATH_GFX.'/daily-all.png';
$rrdexecstart = SS_RRDTOOL_COMMAND . " graph $rrdgfx --lazy -l 0 -a PNG -s e-1w";
exec($rrdexecstart.$rrdexecend); DisplayGraph($txt_freq, $rrdgfx);
// generate and display the 5 weeks graph
$txt_freq = 'weekly';
$rrdgfx = SS_PATH_GFX.'/weekly-all.png';
$rrdexecstart = SS_RRDTOOL_COMMAND . " graph $rrdgfx --lazy -l 0 -a PNG -s e-5w";
exec($rrdexecstart.$rrdexecend); DisplayGraph($txt_freq, $rrdgfx);
// generate and display the 12 months graph
$txt_freq = 'monthly';
$rrdgfx = SS_PATH_GFX.'/monthly-all.png';
$rrdexecstart = SS_RRDTOOL_COMMAND . " graph $rrdgfx --lazy -l 0 -a PNG -s e-1y";
exec($rrdexecstart.$rrdexecend); DisplayGraph($txt_freq, $rrdgfx);
// generate and display the 12 months graph
$txt_freq = 'uptime';
$rrdgfx = SS_PATH_GFX.'/uptime.png';
$rrdexecstart = SS_RRDTOOL_COMMAND . "uptime";
exec($rrdexecstart.$rrdexecend); DisplayGraph($txt_freq, $rrdgfx);
endif;
?>