This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/htdocs/node.summary.php

127 lines
7.1 KiB
PHP
Raw Normal View History

2011-01-13 14:45:19 +00:00
<?php
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/htdocs/node.summary.php,v 1.5 2009/04/19 04:00:59 wurley Exp $
# This page should return all a summary of Client activitie, for the last 24 hours.
# @TODO: Need to allow for multiple schedules in 1 day.
# Required Libraries
require './common.php';
# Defaults
$todayDate = date('Y-m-d H:i');
$yesterDate = date('Y-m-d H:i',time()-86400);
$summaryInfo = objectCache('summaryinfo');
$nodes = objectCache('nodes');
# Data collection.
$tsmBackupSummary = $app['server']->GetActlogBackupSummary($yesterDate,$todayDate);
# Database Summary Information
$blockTitle['sched'] = sprintf(_('Client Schedule Activity on %s'),$app['server']->getValue('server','name'));
$blockBody['sched'] = '<table border=0>';
$blockBody['sched'] .= '<tr><td width=100%><table class="result" width=100%>';
$blockBody['sched'] .= sprintf('<tr><td class="titlel">%s</td><td class="titlel">%s</td><td class="titlel">%s</td><td class="titlel">%s</td></tr>',
'Client','Schedule','Sched Status','Sched Start');
$counter = 0;
$events = $app['server']->GetEvents($yesterDate,$todayDate,'ACTUAL_START');
if (count($events['detail'])) {
foreach ($events['detail'] as $index => $tsmEvent) {
$node = $nodes->getNode($tsmEvent['NODE_NAME']);
$blockBody['sched'] .= sprintf('<tr class="%s"><td><acronym title="%s (%s.%s.%s.%s)">%s</acronym></td><td>%s</td><td><acronym title="Result Code %s">%s</acronym></td><td>%s</td></tr>',
$tsmEvent['STATUS'] == 'Failed' ? 'highlight' : ($counter++%2==0?'even':'odd'),
$node->os,
$node->level['tsm_ver'],$node->level['tsm_rel'],$node->level['tsm_lvl'],$node->level['tsm_slv'],
$tsmEvent['NODE_NAME'],
$tsmEvent['SCHEDULE_NAME'],
$tsmEvent['RESULT'],$tsmEvent['STATUS'],
tsmDate($tsmEvent['ACTUAL_START']));
$key = $tsmEvent['STATUS'].' '.$tsmEvent['RESULT'];
@$graph['data'][$tsmEvent['SCHEDULE_NAME']][$key]++;
@$graph['legend'][$key]++;
}
} else {
$graph = false;
}
$blockBody['sched'] .= '</table></td>';
if ($graph) {
$_SESSION['graph']['backupevent'] = $graph;
$blockBody['sched'] .= sprintf('<td align="right"><img src="image.backupevents.php?index=%s" /></td>',
$app['server']->getIndex());
}
$blockBody['sched'] .= '</tr></table>';
$blockTitle['backup'] = sprintf(_('Client Backup Session Summary on %s'),$app['server']->getValue('server','name'));
$blockBody['backup'] = '<table class="result">';
$blockBody['backup'] .= sprintf('<tr><td class="titlel">%s</td><td class="titlel">%s</td><td class="titlel">%s</td><td class="titlel">%s</td><td class="titler">%s</td><td class="titler">%s</td><td class="titler">%s</td><td class="titler">%s</td><td class="titler">%s</td><td class="titler">%s</td><td class="titler">%s</td><td class="titler">%s</td></tr>',
'Client','Sched','Date','Type','Session','Inspected','Backed Up','Failed','Time','MB','Agg Rate Kb/s','Compressed');
$counter = 0;
$summary = $summaryInfo->getSummary($yesterDate,$todayDate);
if (! count($summary))
$blockBody['backup'] .= sprintf('<tr><td colspan=0>%s</td></tr>','No summary');
else
foreach ($summary as $tsmSession) {
if (! in_array($tsmSession['ACTIVITY'],array('BACKUP','ARCHIVE'))) continue;
# Summary Information
$client_summary = sprintf('Update: %s, Rebound: %s, Delete: %s, Expire: %s.',
(isset($tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Update']) ? $tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Update'] : '-'),
(isset($tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Rebound']) ? $tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Rebound'] : '-'),
(isset($tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Delete']) ? $tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Delete'] : '-'),
(isset($tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Expire']) ? $tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Expire'] : '-'));
$blockBody['backup'] .= sprintf('<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td><acronym title="%s">%s</acronym></td><td align="right">%s</td><td align="right">%s</td><td align="right">%s</td><td align="right">%s</td><td align="right">%s</td><td align="right">%s</td><td align="right">%s</td><td align="right">%s</td></tr>',
($counter++%2==0?'even':'odd'),
$tsmSession['ENTITY'],
$tsmSession['SCHEDULE_NAME'],
tsmDate($tsmSession['START_TIME'],'daytime'),
$client_summary,
$tsmSession['ACTIVITY'],
$tsmSession['NUMBER'],
number_format($tsmSession['EXAMINED']),
$tsmSession['AFFECTED'],
(isset($tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Failed']) ? $tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Failed'] : '-'),
(isset($tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['ProcTime']) ? $tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['ProcTime'] : '-'),
sprintf('%3.2f',$tsmSession['BYTES']/1024/1024),
(isset($tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['AggRate']) ? $tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['AggRate'] : '-'),
(isset($tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Compress']) ? $tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['Compress'] : '-'));
}
$blockBody['backup'] .= '</table>';
$counter = 0;
$blockTitle['restore'] = sprintf(_('Client Restore Session Summary on %s'),$app['server']->getValue('server','name'));
$blockBody['restore'] = '<table class="result">';
$blockBody['restore'] .= sprintf('<tr><td class="titlel">%s</td><td class="titlel">%s</td><td class="titlel">%s</td><td class="titlel">%s</td><td class="titler">%s</td><td class="titler">%s</td><td class="titler">%s</td><td class="titler">%s</td><td class="titler">%s</td><td class="titler">%s</td></tr>',
'Client','Time','Session','Type','Restored','Failed','Media W','Time','MB','Agg Rate Kb/s');
foreach ($summary as $tsmSession) {
if (! in_array($tsmSession['ACTIVITY'],array('RESTORE','RETRIEVE'))) continue;
$blockBody['restore'] .= sprintf('<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td align="right">%s</td><td align="right">%s</td><td align="right">%s</td><td align="right">%s</td><td align="right">%s</td><td align="right">%s</td></tr>',
($counter++%2==0?'even':'odd'),
$tsmSession['ENTITY'],
tsmDate($tsmSession['START_TIME'],'nosec'),
$tsmSession['NUMBER'],
$tsmSession['ACTIVITY'],
$tsmSession['AFFECTED'],
$tsmSession['FAILED'],
$tsmSession['MEDIAW'],
(isset($tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['ProcTime']) ? $tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['ProcTime'] : '-'),
sprintf('%3.1fMB',$tsmSession['BYTES']/1024/1024),
(isset($tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['AggRate']) ? $tsmBackupSummary['detail'][$tsmSession['ENTITY']][$tsmSession['NUMBER']]['AggRate'] : '-'),
$tsmSession['SCHEDULE_NAME']);
}
$blockBody['restore'] .= '</table>';
# End
render_page($blockTitle,$blockBody);
?>