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/volume.info.php
2011-01-14 01:45:19 +11:00

161 lines
7.2 KiB
PHP

<?php
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/htdocs/volume.info.php,v 1.21 2009/04/19 04:57:32 wurley Exp $
# Required Libraries
require './common.php';
# Defaults
$volumes = objectCache('volumes');
$blockTitle['volinfo'] = 'Volume(s) that may need attention';
$blockBody['volinfo'] = '<br /><table class="result_table" border=0>';
$blockBody['volinfo'] .= '<tr><td class="heading">Library</td><td class="heading">Slot</td><td class="heading">Barcode/Vol Name</td><td class="heading">Usage</td><td class="heading">Status/Access</td><td class="heading">Library Access</td><td class="heading">Utilisation</td><td class="heading">Reclaim</td><td class="heading">Last Read</td><td class="heading">Last Write</td></tr>';
# The following COPY VOLUMES in the library can be checked out.
if (count($volumes->libCopyVolumes(true))) {
$blockBody['volinfo'] .= sprintf('<tr><td colspan=0><b>%s</b></td></tr>',_('The following COPY pool volumes can be checked out of the library(s).'));
$counter = 0;
foreach ($volumes->libCopyVolumes(true) as $volume) {
$blockBody['volinfo'] .= sprintf('<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s/%s</td><td>%s</td><td>%s%%</td><td>%s%%</td><td>%s</td><td>%s</td></tr>',
$counter++%2 ? 'even' : 'odd',
$volume->lib['name'],
isset($volume->location) ? $volume->location : 'InLIB',
$volume->getName(),
$volume->stgpool,
$volume->status['volume'],
$volume->access,
'N/A',
$volume->utilisation,
$volume->reclaim,
tsmDate($volume->last['read'],'notime'),tsmDate($volume->last['write'],'notime'));
}
$blockBody['volinfo'] .= '<tr><td colspan=0>&nbsp;</td></tr>';
}
# Non-Read/Write Volumes that need to be fixed.
if (count($volumes->nonReadWriteVolumes())) {
$blockBody['volinfo'] .= sprintf('<tr><td colspan=0><b>%s</b></td></tr>',_('NON READ/WRITE volumes that need to be addressed.'));
$counter = 0;
foreach ($volumes->nonReadWriteVolumes() as $volume) {
$blockBody['volinfo'] .= sprintf('<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s/%s</td><td>%s</td><td>%s%%</td><td>%s%%</td><td>%s</td><td>%s</td></tr>',
$counter++%2 ? 'even' : 'odd',
isset($volume->lib['name']) ? $volume->lib['name'] : '&nbsp;',
isset($volume->location) ? $volume->location : 'InLIB',
$volume->name,
$volume->stgpool,
$volume->status['volume'],
$volume->access,
'N/A',
$volume->utilisation,
$volume->reclaim,
tsmDate($volume->last['read'],'notime'),tsmDate($volume->last['write'],'notime'));
}
$blockBody['volinfo'] .= '<tr><td colspan=0>&nbsp;</td></tr>';
}
# Non-Read/Write Volumes that need to be fixed.
if (count($volumes->reclaimVolumes())) {
$blockBody['volinfo'] .= sprintf('<tr><td colspan=0><b>%s</b></td></tr>',_('The following volumes should be RECLAIMed (automatically).'));
$counter = 0;
foreach ($volumes->reclaimVolumes() as $volume) {
$blockBody['volinfo'] .= sprintf('<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s/%s</td><td>%s</td><td>%s%%</td><td>%s%%</td><td>%s</td><td>%s</td></tr>',
$counter++%2 ? 'even' : 'odd',
isset($volume->lib['name']) ? $volume->lib['name'] : '&nbsp;',
isset($volume->location) ? $volume->location : 'InLIB',
$volume->getName(),
$volume->stgpool,
$volume->status['volume'],
$volume->access,
'N/A',
$volume->utilisation,
$volume->reclaim,
tsmDate($volume->last['read'],'notime'),tsmDate($volume->last['write'],'notime'));
}
$blockBody['volinfo'] .= '<tr><td colspan=0>&nbsp;</td></tr>';
}
# Following volumes have had errors.
if (count($volumes->errorVolumes())) {
$blockBody['volinfo'] .= sprintf('<tr><td colspan=0><b>%s</b></td></tr>',_('The following volumes have had ERRORS.'));
$counter = 0;
foreach ($volumes->errorVolumes() as $volume) {
$blockBody['volinfo'] .= sprintf('<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s/%s</td><td>%s</td><td>%s%%</td><td>%s%%</td><td>%s (%s)</td><td>%s (%s)</td></tr>',
$counter++%2 ? 'even' : 'odd',
isset($volume->lib['name']) ? $volume->lib['name'] : '&nbsp;',
isset($volume->location) ? $volume->location : 'InLIB',
$volume->name,
$volume->stgpool,
$volume->status['volume'],
$volume->access,
'N/A',
$volume->utilisation,
$volume->reclaim,
tsmDate($volume->last['read'],'notime'),$volume->error['read'],
tsmDate($volume->last['write'],'notime'),$volume->error['write']);
}
$blockBody['volinfo'] .= '<tr><td colspan=0>&nbsp;</td></tr>';
}
# Following volumes have not been read/written to for a long time.
if (count($volumes->staleVolumes($app['server']->getValue('system','tapeage')))) {
$blockBody['volinfo'] .= sprintf('<tr><td colspan=0><b>%s</b></td></tr>',sprintf(_('The following volumes have NOT been read/written to for %s days.'),$app['server']->getValue('system','tapeage')));
$counter = 0;
foreach ($volumes->staleVolumes($app['server']->getValue('system','tapeage')) as $volume) {
$blockBody['volinfo'] .= sprintf('<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s/%s</td><td>%s</td><td>%s%%</td><td>%s%%</td><td>%s</td><td>%s</td></tr>',
$counter++%2 ? 'even' : 'odd',
isset($volume->lib['name']) ? $volume->lib['name'] : '&nbsp;',
isset($volume->location) ? $volume->location : 'InLIB',
$volume->getName(),
$volume->stgpool,
$volume->status['volume'],
$volume->access,
'N/A',
$volume->utilisation,
$volume->reclaim,
tsmDate($volume->last['read'],'notime'),tsmDate($volume->last['write'],'notime'));
}
$blockBody['volinfo'] .= '<tr><td colspan=0>&nbsp;</td></tr>';
}
# Following volumes are empty or pending.
if (count($volumes->pendingVolumes()) || count($volumes->emptyVolumes())) {
$blockBody['volinfo'] .= sprintf('<tr><td colspan=0><b>%s</b></td></tr>',_('The following volumes are either EMPTY or PENDING.'));
$counter = 0;
foreach ($volumes->pendingVolumes() as $volume) {
$blockBody['volinfo'] .= sprintf('<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><acronym title="Pending: %s Avail: %s">%s</acronym>/%s</td><td>%s</td><td>%s%%</td><td>%s%%</td><td>%s</td><td>%s</td></tr>',
$counter++%2 ? 'even' : 'odd',
isset($volume->lib['name']) ? $volume->lib['name'] : '&nbsp;',
isset($volume->location) ? $volume->location : 'InLIB',
$volume->name,
$volume->stgpool,
tsmDate($volume->pending['start'],'notime'),tsmDate($volume->pending['end'],'notime'),
$volume->status['volume'],
$volume->access,
'N/A',
$volume->utilisation,
$volume->reclaim,
tsmDate($volume->last['read'],'notime'),tsmDate($volume->last['write'],'notime'));
}
$counter = 0;
foreach ($volumes->emptyVolumes() as $volume) {
$blockBody['volinfo'] .= sprintf('<tr class="%s"><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s/%s</td><td>%s</td><td>%s%%</td><td>%s%%</td><td>%s</td><td>%s</td></tr>',
$counter++%2 ? 'even' : 'odd',
isset($volume->lib['name']) ? $volume->lib['name'] : '&nbsp;',
isset($volume->location) ? $volume->location : 'InLIB',
$volume->getName(),
$volume->stgpool,
$volume->status['volume'],
$volume->access,
'N/A',
$volume->utilisation,
$volume->reclaim,
tsmDate($volume->last['read'],'notime'),tsmDate($volume->last['write'],'notime'));
}
}
$blockBody['volinfo'] .= '</table>';
# End
render_page($blockTitle,$blockBody);
?>