More work on library display

This commit is contained in:
Deon George 2011-06-27 14:37:11 +10:00
parent b2c250c319
commit c4ef5e2275
11 changed files with 136 additions and 666 deletions

View File

@ -33,7 +33,7 @@ class Model_LIBRARY extends ORMTSM {
}
// Return a list of scratch volumes
public function scratch() {
public function scratchvol() {
$return = array();
foreach ($this->slots() as $slot)
@ -44,7 +44,7 @@ class Model_LIBRARY extends ORMTSM {
}
// Return a list of volumes that are readonly
public function readonly() {
public function readonlyvol() {
$return = array();
foreach ($this->slots() as $slot)
@ -60,7 +60,7 @@ class Model_LIBRARY extends ORMTSM {
}
// Return the slots that are used, but not checked in.
public function notcheckedin() {
public function notcheckedinvol() {
$return = array();
foreach ($this->slots() as $slot)
@ -95,20 +95,22 @@ class Model_LIBRARY extends ORMTSM {
return $result;
}
// Return a list of volumes
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
// @param $inout IN|OUT of the library
// @param $status volume status FULL|FILLING|PENDING|EMPTY
// @note This is an intensive method that needs caching.
public function volstype($type,$inout,$status) {
/**
* Return a list of volumes
*
* @param $ptype is pool type (PRIMARY,ACTIVE,COPY)
* @param $inout IN|OUT of the library
* @param $status volume status FULL|FILLING|PENDING|EMPTY
* @note This is an intensive method that needs caching.
*/
public function volstype($ptype,$inout,$status) {
static $CACHE = array();
$ainout = array('in','out');
$astatus = array('FULL','FILLING','PENDING','EMPTY');
$ainout = array('IN','OUT');
if (! isset($CACHE[__METHOD__][$type]))
foreach ($this->storagepoolstype($type) as $spo)
if (! isset($CACHE[__METHOD__][$ptype]))
foreach ($this->storagepoolstype($ptype) as $spo)
foreach ($ainout as $cinout)
foreach ($astatus as $cstatus) {
foreach (Kohana::config('config.tsmvolstatus') as $cstatus) {
if (! isset($CACHE[__METHOD__][$spo->POOLTYPE][$cinout][$cstatus]))
$CACHE[__METHOD__][$spo->POOLTYPE][$cinout][$cstatus] = array();
@ -116,7 +118,36 @@ class Model_LIBRARY extends ORMTSM {
array_merge($CACHE[__METHOD__][$spo->POOLTYPE][$cinout][$cstatus],$spo->libvolstype($cinout,$cstatus));
}
return isset($CACHE[__METHOD__][$type][$inout][$status]) ? $CACHE[__METHOD__][$type][$inout][$status] : array();
return isset($CACHE[__METHOD__][$ptype][$inout][$status]) ? $CACHE[__METHOD__][$ptype][$inout][$status] : array();
}
/**
* Return a list of DB volumes
*
* @param $inout IN|OUT of the library
* @note This is an intensive method that needs caching.
*/
public function dbvolsloc($inout) {
static $CACHE = array();
if (! isset($CACHE[__METHOD__]))
foreach (ORM::factory('volhistory')->where('TYPE','IN',Kohana::config('config.tsmdbtypes'))->find_all() as $vho)
$CACHE[__METHOD__][$vho->LIBVOLUME ? 'IN' : 'OUT'][] = $vho;
return isset($CACHE[__METHOD__][$inout]) ? $CACHE[__METHOD__][$inout] : array();
}
// Return a list of DB volumes by type
// @param $inout IN|OUT of the library
// @param $dtype is DB vole type (BACKUPFULL,BACKUPINCR,DBSNAPSHOT)
public function dbvolstype($inout,$dtype) {
$result = array();
foreach ($this->dbvolsloc($inout) as $vho)
if ($vho->TYPE ==$dtype)
array_push($result,$vho);
return $result;
}
public function volsnotinlib() {
@ -130,5 +161,28 @@ class Model_LIBRARY extends ORMTSM {
Sort::masort($result,'VOLUME_NAME');
return $result;
}
// Volumes that are stale
public function stalevol() {
$result = array();
foreach ($this->storagepools() as $spo)
foreach ($spo->VOLUME->find_all() as $vo)
if ($vo->recycle())
array_push($result,$vo);
Sort::masort($result,'VOLUME_NAME');
return $result;
}
public function removablelibvol() {
$result = array();
foreach ($this->slots() as $slot)
if ($slot->LIBVOLUME->removable())
array_push($result,$slot->LIBVOLUME);
return $result;
}
}
?>

View File

@ -79,5 +79,8 @@ class Model_LIBVOLUME extends ORMTSM {
}
}
public function removable() {
return ($this->usage() == 'dbbackup' OR ($this->usage() != 'scratch' AND $this->VOLUME->STGPOOL->POOLTYPE != 'PRIMARY')) ? TRUE : FALSE;
}
}
?>

View File

@ -17,6 +17,7 @@ class Model_VOLHISTORY extends ORMTSM {
);
protected $_has_one = array(
'LIBVOLUME'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
'VOLUME'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
);
protected $_has_many = array(

View File

@ -19,6 +19,7 @@ class Model_VOLUME extends ORMTSM {
protected $_has_one = array(
'MEDIA'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
'STGPOOL'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
);
protected $_has_many = array(
'VOLUMEUSAGE'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
@ -52,5 +53,17 @@ class Model_VOLUME extends ORMTSM {
public function location() {
return $this->display('LOCATION');
}
// Age of a volume, based on last read/write access.
public function age() {
if (! $this->LAST_READ_DATE AND ! $this->LAST_WRITE_DATE)
return 0;
else
return (int)((time()-(strtotime(strtotime($this->LAST_READ_DATE) > strtotime($this->LAST_WRITE_DATE) ? $this->LAST_WRITE_DATE : $this->LAST_READ_DATE)))/86400);
}
public function recycle() {
return Kohana::config('config.tsmtapeage') < $this->age() ? TRUE : FALSE;
}
}
?>

View File

@ -15,8 +15,11 @@ return array(
'client' => '/opt/tivoli/tsm/client/ba/bin/dsmadmc',
'client_errorlogname' => '/tmp/pta-tsm-errorlog.log',
'date_format' => 'd-m-Y',
'tsmpooltypes' => array('PRIMARY','ACTIVEDATA','COPY'),
'tsmdatatypes' => array('Bkup'=>'BACKUP','Arch'=>'ARCHIVE'),
'tsmdbtypes' => array('BACKUPFULL','BACKUPINCR','DBSNAPSHOT'),
'tsmpooltypes' => array('PRIMARY','ACTIVEDATA','COPY'),
'tsmvolstatus' => array('FULL','FILLING','PENDING','EMPTY'),
'tsmtapeage' => 180, // Age of tapes before prompting to rotate
'email_admin_only'=> array(
'method'=>array('wurley@users.sf.net'=>'Deon George'),
),

View File

@ -9,6 +9,7 @@ td.head { font-weight: bold; }
td.bold { font-weight: bold; }
td.bold-right { font-weight: bold; text-align: right; }
td.data { font-weight: bold; }
span.data { font-weight: bold; }
td.data-right { font-weight: bold; text-align: right; }
td.right { text-align: right; }
tr.odd { background-color: #FCFCFE; }

View File

@ -71,15 +71,23 @@
</tr>
<tr>
<td colspan="2">Not Checked In</td>
<td class="data" colspan="8"><?php echo count($lo->notcheckedin()); ?></td>
<td class="data" colspan="8"><?php echo count($lo->notcheckedinvol()); ?></td>
</tr>
<tr>
<td colspan="2">Scratch</td>
<td class="data" colspan="8"><?php echo count($lo->scratch()); ?></td>
<td class="data" colspan="8"><?php echo count($lo->scratchvol()); ?></td>
</tr>
<tr>
<td colspan="2">Read Only</td>
<td class="data" colspan="8"><?php echo count($lo->readonly()); ?></td>
<td class="data" colspan="8"><?php echo count($lo->readonlyvol()); ?></td>
</tr>
<tr>
<td colspan="2">&sup1; Stale Storage Pool Volumes (<span class="data"><?php echo Kohana::config('config.tsmtapeage'); ?></span> days)</td>
<td class="data" colspan="8"><?php echo count($lo->stalevol()); ?></td>
</tr>
<tr>
<td colspan="2">&sup2; Removable Volumes</td>
<td class="data" colspan="8"><?php echo count($lo->removablelibvol()); ?></td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
@ -92,39 +100,47 @@
</tr>
<tr>
<td colspan="2">Storage Type</td>
<td class="right">IN: FULL</td>
<td class="right">IN: FILLING</td>
<td class="right">IN: PENDING</td>
<td class="right">IN: EMPTY</td>
<td class="right">OUT: FULL</td>
<td class="right">OUT: FILLING</td>
<td class="right">OUT: PENDING</td>
<td class="right">OUT: EMPTY</td>
<?php foreach (array('IN','OUT') as $inout) { ?>
<?php foreach (Kohana::config('config.tsmvolstatus') as $status) { ?>
<td class="right"><?php printf('%s: %s',$inout,$status); ?></td>
<?php } ?>
<?php } ?>
</tr>
<?php $i=0; foreach (Kohana::config('config.tsmpooltypes') as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data" colspan="2">DB VOLS</td>
<?php foreach (array('IN','OUT') as $inout) { ?>
<td class="data-right"><?php echo count($lo->dbvolsloc($inout)); ?></td>
<td colspan="3">&nbsp;</td>
<?php } ?>
</tr>
<?php $i=0; foreach (Kohana::config('config.tsmdbtypes') as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td>&nbsp;</td>
<td><?php echo $type; ?></td>
<?php foreach (array('IN','OUT') as $inout) { ?>
<td class="right"><?php echo count($lo->dbvolstype($inout,$type)); ?></td>
<td colspan="3">&nbsp;</td>
<?php } ?>
</tr>
<?php } ?>
<?php foreach (Kohana::config('config.tsmpooltypes') as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data" colspan="2"><?php echo $type; ?></td>
<td class="data-right"><?php echo count($lo->volstype($type,'in','FULL')); ?></td>
<td class="data-right"><?php echo count($lo->volstype($type,'in','FILLING')); ?></td>
<td class="data-right"><?php echo count($lo->volstype($type,'in','PENDING')); ?></td>
<td class="data-right"><?php echo count($lo->volstype($type,'in','EMPTY')); ?></td>
<td class="data-right"><?php echo count($lo->volstype($type,'out','FULL')); ?></td>
<td class="data-right"><?php echo count($lo->volstype($type,'out','FILLING')); ?></td>
<td class="data-right"><?php echo count($lo->volstype($type,'out','PENDING')); ?></td>
<td class="data-right"><?php echo count($lo->volstype($type,'out','EMPTY')); ?></td>
<?php foreach (array('IN','OUT') as $inout) { ?>
<?php foreach (Kohana::config('config.tsmvolstatus') as $status) { ?>
<td class="data-right"><?php echo count($lo->volstype($type,$inout,$status)); ?></td>
<?php } ?>
<?php } ?>
</tr>
<?php foreach ($lo->storagepoolstype($type) as $spo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td>&nbsp;</td>
<td><?php echo $spo; ?></td>
<td class="right"><?php echo count($spo->libvolstype('in','FULL')); ?></td>
<td class="right"><?php echo count($spo->libvolstype('in','FILLING')); ?></td>
<td class="right"><?php echo count($spo->libvolstype('in','PENDING')); ?></td>
<td class="right"><?php echo count($spo->libvolstype('in','EMPTY')); ?></td>
<td class="right"><?php echo count($spo->libvolstype('out','FULL')); ?></td>
<td class="right"><?php echo count($spo->libvolstype('out','FILLING')); ?></td>
<td class="right"><?php echo count($spo->libvolstype('out','PENDING')); ?></td>
<td class="right"><?php echo count($spo->libvolstype('out','EMPTY')); ?></td>
<?php foreach (array('IN','OUT') as $inout) { ?>
<?php foreach (Kohana::config('config.tsmvolstatus') as $status) { ?>
<td class="right"><?php echo count($spo->libvolstype($inout,$status)); ?></td>
<?php } ?>
<?php } ?>
</tr>
<?php } ?>
<?php } ?>
@ -190,7 +206,7 @@
</tr>
<?php $i=0; foreach ($slots as $slot) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data"><?php echo HTML::nbsp($slot->barcodelabel()); ?></td>
<td class="data"><?php echo HTML::nbsp($slot->barcodelabel().($slot->LIBVOLUME->VOLUME->recycle() ? ' &sup1' : '').($slot->LIBVOLUME->removable() ? ' &sup2' : '')); ?></td>
<td class="data"><?php echo $slot->LIBVOLUME->volusage(); ?></td>
<td class="data"><?php echo HTML::nbsp($slot->LIBVOLUME->status()); ?></td>
<td class="data"><?php echo $slot->LIBVOLUME->VOLUME->display('PCT_UTILIZED'); ?></td>

View File

@ -1,319 +0,0 @@
<?php
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/htdocs/devclass.info.php,v 1.13 2009/04/19 03:53:40 wurley Exp $
# Required Libraries
require './common.php';
# @todo: Graph storage by storage pool
# Defaults
$devclasses = objectCache('devclasses');
$volumes = objectCache('volumes');
$drives = objectCache('drives');
$stgps = objectCache('stgps');
$occupancy = objectCache('occupancy');
$nodes = objectCache('nodes');
# Start
echo 'Show device class';
echo '<form action="cmd.php">';
printf('<input type="hidden" name="cmd" value="%s" />',get_request('cmd','REQUEST'));
printf('<input type="hidden" name="index" value="%s" />',$app['server']->getIndex());
echo '<select name="devclass" onchange="javascript:submit()">';
echo '<option value="">&nbsp;</option>';
foreach ($devclasses->getDevClasses() as $devc => $devclass) {
printf('<option value="%s" %s>%s</option>',
$devclass->getName(),
(isset($_REQUEST['devclass']) && ($_REQUEST['devclass'] == $devclass->getName())) ? 'selected' : '',
$devclass->getName());
}
echo '</select>';
echo '</form>';
if (isset($_REQUEST['devclass']) && trim($_REQUEST['devclass']))
foreach ($devclasses->getDevClasses() as $devc => $devclass) {
if ($_REQUEST['devclass'] != $devclass->getName())
continue;
echo '<table width="100%" class="page_detail" border=0>';
printf(_('<tr><td>Device Class</td><td><b>%s</b></td><td>&nbsp;</td></tr>'),$devc);
printf('<tr><td>Type</td><td>'.
classValue(_('%s %s media is used for this device class.'),'value').
'</td><td>&nbsp;</td></tr>',
$devclass->access,
$devclass->type);
if (trim($devclass->library)) {
printf('<tr><td>Library</td><td>'.
classValue(_('%s library is used to store this media.'),'value').
'</td><td>&nbsp;</td></tr>',
$devclass->library);
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s drives defined in this library.'),'value').
'</td><td>&nbsp;</td></tr>',
count($drives->getDrives($devclass->library)));
}
if (trim($devclass->dir))
printf('<tr><td>Local Directory</td><td>'.
classValue(_('%s directory will contain %s volumes for this device class.'),'value').
'</td><td>&nbsp;</td></tr>',
$devclass->dir,$devclass->capacity);
echo '</table>';
echo '<br />';
printf(_('Storage Pools using device class %s.').'<br />',$devc);
$stgcount = 0;
foreach ($stgps->getStoragePools() as $stgp => $stgpool) {
# Ignore storage pools not of this device class.
if ($stgpool->devclass != $devc) continue;
echo '<table width="100%" class="result" border=0>';
# Title
echo "\n\n";
printf('<tr><td colspan=2 class="titlel">%s - %s (%s)</td><td class="titlec">&nbsp;</td></tr>',
$stgpool->getName(),$stgpool->type,$stgpool->access);
# Utlisation and Migration details
echo "\n\n";
switch ($stgpool->type) {
case 'PRIMARY' :
switch ($devclass->access) {
case 'Sequential' :
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s%% storage capacity utilised with %s%% volumes used.'),
'value').
'</td><td>&nbsp;</td></tr>',
$stgpool->utilisation,$stgpool->migratable);
break;
case 'Random' :
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s%% storage capacity utilised with %s%% migratable data.'),
'value').
'</td><td>&nbsp;</td></tr>',
$stgpool->utilisation,$stgpool->migratable);
break;
default :
printf('<tr><td colspan=2>Unknown access strategy %s.</td><td>',$devclass->access);
}
break;
case 'COPY' :
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s%% storage capacity utilised.'),'value').
'</td><td>&nbsp;</td></tr>',
$stgpool->utilisation);
break;
default :
printf('<tr><td colspan=2><b>%s</b> %s.</td><td>',
_('Unknown pooltype'),$stgpool->type);
}
# Max object size
echo "\n\n";
if ($stgpool->maxsize)
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%3.2fMB Maximum Object Size.'),'value').
'</td><td>&nbsp;</td></tr>',
$stgpool->maxsize/1024/1024);
if ($stgpool->reclaim)
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s%% wasted space is required before reclaimation. Reclamation will use %s'),
'value').
'</td><td>&nbsp;</td></tr>',
$stgpool->reclaim,($stgpool->reclaimstgp ? $stgpool->reclaimstgp : $stgp));
if ($stgpool->reclaimrunning)
printf('<tr><td>&nbsp;</td><td>'.
_('Reclamation IS currently running.').
'</td><td>&nbsp;</td></tr>');
if ($stgpool->reuse)
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s days must pass before volumes will be reused.'),'value').
'</td><td>&nbsp;</td></tr>',
$stgpool->reuse);
# Migration details
if ($stgpool->nextstgp)
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('Migration to %s will occur at %s%% (stopping at %s%%)'),'value').
'</td><td>&nbsp;</td></tr>',
$stgpool->nextstgp,$stgpool->migr['hi'],$stgpool->migr['low']);
if ($stgpool->migr['running'])
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('Migration IS currently running. %sMB Migrated %ss'),'value').
'</td><td>&nbsp;</td></tr>',
$stgpool->migr['mb'],$stgpool->migr['sec']);
# Collocation Information
if ($stgpool->collocate)
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s Collocation.'),'value').
'</td><td>&nbsp;</td></tr>',
$stgpool->collocate);
# Disk Caching.
if ($stgpool->cache)
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s Migration caching.'),'value').
'</td><td>&nbsp;</td></tr>',
$stgpool->cache);
$stgcount++;
echo '<tr><td>&nbsp;</td></tr>';
# Volume information.
echo "\n\n";
switch ($devclass->type) {
case 'DISK' :
if ($volumes->getStoragePoolVolumes($stgpool->getName()))
foreach ($volumes->getStoragePoolVolumes($stgpool->getName()) as $volume) {
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('Vol %s (%s%% %s) - %s.'),'value').
'</td><td>&nbsp;</td></tr>',
$volume->getName(),$volume->utilisation,
$volume->status['volume'],
$volume->access);
}
break;
default :
# Scratch Media
$temp = '';
if (count($volumes->getStoragePoolScratchVolumes($stgpool->getName())))
$temp .= sprintf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s scratch media in use (of %s).'),'value').
'</td><td>&nbsp;</td></tr>',
count($volumes->getStoragePoolScratchVolumes($stgpool->getName())),$stgpool->maxscratch);
if (count($volumes->getStoragePoolDefinedVolumes($stgpool->getName())))
$temp .= sprintf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s defined media in use.'),'value').
'</td><td>&nbsp;</td></tr>',
count($volumes->getStoragePoolDefinedVolumes($stgpool->getName())));
if ($temp) {
printf('<tr><td colspan=3>%s</td></tr>',
_('Media SCRATCH Status'));
echo $temp;
echo '<tr><td>&nbsp;</td></tr>';
$temp = '';
}
# Media Access
foreach (array('FULL','FILLING','PENDING','EMPTY') as $status) {
if (count($volumes->getStoragePoolVolumesStatus($stgpool->getName(),$status)))
$temp .= sprintf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s media %s.'),'value').
'</td><td>&nbsp;</td></tr>',
count($volumes->getStoragePoolVolumesStatus($stgpool->getName(),$status)),$status);
}
if ($temp) {
printf('<tr><td colspan=3>%s</td></tr>',
_('Media FILLING Status'));
echo $temp;
echo '<tr><td>&nbsp;</td></tr>';
$temp = '';
}
foreach (array('READWRITE','READONLY','UNAVAILABLE','OFFSITE','DESTROYED') as $status) {
if (count($volumes->getStoragePoolVolumesAccess($stgpool->getName(),$status)))
$temp .= sprintf('<tr><td>&nbsp;</td><td>'.
classValue(_('%s media %s.'),'value').
'</td><td>&nbsp;</td></tr>',
count($volumes->getStoragePoolVolumesAccess($stgpool->getName(),$status)),$status);
}
if ($temp) {
printf('<tr><td colspan=3>%s</td></tr>',
_('Media ACCESS Status'));
echo $temp;
echo '<tr><td>&nbsp;</td></tr>';
$temp = '';
}
# Utilisation
$stat['count'] = 0;
$stat['util'] = 0;
$stat['reclaim'] = 0;
$stat['cap'] = 0;
foreach ($volumes->getStoragePoolVolumes($stgpool->getName()) as $volume) {
$stat['util'] += $volume->utilisation;
$stat['reclaim'] += $volume->reclaim;
$stat['cap'] += $volume->estcap;
$stat['count']++;
}
if ($stat['count'] > 0) {
printf('<tr><td colspan=3>%s</td></tr>',
_('Media Stats'));
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%3.2f%% average utilisation.'),'value').
'</td><td>&nbsp;</td></tr>',
$stat['util']/$stat['count']);
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%3.2f%% average wasted space.'),'value').
'</td><td>&nbsp;</td></tr>',
$stat['reclaim']/$stat['count']);
printf('<tr><td>&nbsp;</td><td>'.
classValue(_('%3.0f MB average capacity.'),'value').
'</td><td>&nbsp;</td></tr>',
$stat['cap']/$stat['count']);
}
break;
}
echo '<tr><td>&nbsp;</td></tr>';
# Nodes with data in this pool
echo "\n\n";
$total = 0;
$nodedata = '';
$counter = 0;
foreach ($occupancy->getStoragePoolTotals($stgpool->getName()) as $node => $typedetails) {
$node = $nodes->getNode($node);
foreach ($typedetails as $type => $details) {
$nodedata .= sprintf('<tr class="%s"><td>%s</td><td>%s</td><td align="right">%s %s</td><td align="right">%s MB</td></tr>',
($counter++%2==0?'even':'odd'),
$node->getName(),$type,
(isset($detail['files']) ? number_format($detail['files']) : '&nbsp;'),
(count($node->getTapeVolumes($stgpool->getName(),$type)) ? count($node->getTapeVolumes($stgpool->getName(),$type)) : '&nbsp;'),
isset($details['physical']) ? number_format($details['physical']) : '&nbsp;');
$total += $details['physical'];
}
}
if ($nodedata) {
echo '<tr><td colspan=2>'."\n\n";
echo '<table class="result_table" border=0>';
printf('<tr><td colspan=4 class="heading">%s</td></tr>',
_('Nodes with data in this storage pool.'));
printf('<tr class="title"><td class="titlel">%s</td><td class="titler">%s</td><td class="titler">%s</td><td class="titler">%s</td></tr>',
_('Node'),_('Type'),_('Volumes'),_('MB'));
echo $nodedata;
printf('<tr class="highlight"><td colspan=3 class="titlel">%s</td><td class="titler">%s MB</td></tr>',
_('Total'),number_format($total));
echo '</table>'."\n\n";
echo '</td><td>&nbsp;</td></tr>';
echo '<tr><td>&nbsp;</td></tr>';
}
echo '</table><br />'."\n\n";
}
if (! $stgcount)
printf('<b>%s</b><br />',_('There are no storage pools using this DEVCLASS.'));
}
?>

View File

@ -1,126 +0,0 @@
<?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);
?>

View File

@ -1,160 +0,0 @@
<?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);
?>

View File

@ -10,14 +10,6 @@
/** Available Commands
*/
$config->configDefinition('command','devclassinfo',array(
'summary'=>'Device Class Info',
'desc'=>'This will show detailed information on your devclasses.',
'default'=>'devclass.info'));
$config->configDefinition('command','help',array(
'summary'=>'Help',
'desc'=>'Help Pages',
'default'=>'help'));
$config->configDefinition('command','libraryinfo',array(
'summary'=>'Library Info',
'desc'=>'Information on Automated Tape Libraries.',
@ -30,10 +22,6 @@ $config->configDefinition('command','nodeoccupancy',array(
'summary'=>'Node Occupancy',
'desc'=>'Summary of Node Occupancy.',
'default'=>'node.occupancy'));
$config->configDefinition('command','nodesummary',array(
'summary'=>'Node Summary',
'desc'=>'Summary of Node activities.',
'default'=>'node.summary'));
$config->configDefinition('command','schedulegantt',array(
'summary'=>'Schedule Gantt',
'desc'=>'Gantt view of todays schedules.',
@ -50,10 +38,6 @@ $config->configDefinition('command','serverstats',array(
'summary'=>'Server Stats',
'desc'=>'TSM Server Performance Stats.',
'default'=>'server.stats'));
$config->configDefinition('command','volumeinfo',array(
'summary'=>'Volume Status',
'desc'=>'Status Information on Sequential Volumes.',
'default'=>'volume.info'));
$config->configDefinition('command','volumeinventory',array(
'summary'=>'Volume Inventory',
'desc'=>'Information on Volumes.',