<?php
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/htdocs/node.thruput.php,v 1.1 2009/04/19 05:27:13 wurley Exp $

# This page should show recent client thruput

# Required Libraries
require './common.php';

$thruput = $app['server']->query("SELECT substr(varchar(END_TIME),1,10) as ADATE,ENTITY,ACTIVITY,cast(float(sum(BYTES))/1024/1024/1024 as dec(8,2)) as GB from SUMMARY where ACTIVITY='BACKUP' and END_TIME>CURRENT_TIMESTAMP-(30)DAY and (ACTIVITY in ('ARCHIVE','BACKUP','RESTORE','RETRIEVE')) group by END_TIME,ENTITY,ACTIVITY order by ADATE desc,ENTITY ",null,false,false);

echo '<table class="result_table">';
printf('<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
	'heading','Date','Node','Type','GB');
$counter = 0;
foreach ($thruput as $details) {
	printf('<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
		$counter++%2 ? 'even' : 'odd',
		$details['ADATE'],$details['ENTITY'],$details['ACTIVITY'],$details['GB']);
}
echo '</table>';
?>
