Work on performance improvements with caching

This commit is contained in:
Deon George 2012-12-04 11:52:10 +11:00
parent eafb80f7fc
commit 1bf8a520e2
30 changed files with 877 additions and 495 deletions

View File

@ -11,11 +11,11 @@ RewriteBase /pta/
</Files>
# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|includes/kohana)\b.* kh.php/$0 [L]
RewriteRule ^(?:application|modules|includes/kohana)\b.* index.php/$0 [L]
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to kh.php/URL
RewriteRule .* kh.php/$0 [PT]
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

View File

@ -50,7 +50,7 @@ abstract class Controller_TemplateDefault_View extends Controller_TemplateDefaul
SystemMessage::add(array(
'title'=>_('Missing required data'),
'type'=>'error',
'body'=>sprintf(_('The %s is required.'),$o->primary_key()),
'body'=>sprintf(_('The %s is required.'),ORM::factory($this->orm)->primary_key()),
));
HTTP::redirect(strtolower($this->request->controller()));

View File

@ -32,80 +32,238 @@ class Model_DOMAIN extends TSM_ORM {
),
);
// Pools used by a domain.
private $pools = array();
// Work out all the storage pools used by a domain.
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
public function getStoragePools($dtype) {
return isset($this->pools[$dtype]) ? $this->pools[$dtype] : $this->_getpools($dtype);
}
private function _getpools($dtype) {
$this->pools[$dtype] = array();
foreach ($this->NODE->find_all() as $no)
foreach ($no->getStoragePools($dtype) as $ptype => $stgpools)
foreach ($stgpools as $spo)
if (! isset($this->pools[$dtype][$ptype]) OR ! in_array($spo,$this->pools[$dtype][$ptype]))
$this->pools[$dtype][$ptype][] = $spo;
return $this->pools[$dtype];
}
// Return the storage pools used for a domain by backup type
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStoragePoolsType($dtype,$ptype) {
if (! isset($this->pools[$dtype]))
$this->_getpools($dtype);
return isset($this->pools[$dtype][$ptype]) ? $this->pools[$dtype][$ptype] : array();
}
// $dtype is BACKUP or ARCHIVE
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStorageModeVols($dtype,$ptype,$spo='') {
/**
* Get all the NODES in this DOMAIN
*/
private function _nodes() {
$result = array();
foreach ($this->NODE->find_all() as $no)
$result = array_merge($result,$no->getStorageModeVols($dtype,$ptype,$spo));
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('NODE')->find_all() as $o)
if ($o->DOMAIN_NAME == $this->DOMAIN_NAME)
array_push($result,$o);
return $result;
}
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStorageModeFiles($dtype,$ptype,$spo='') {
$count = 0;
foreach ($this->NODE->find_all() as $no)
$count += $no->getStorageModeFiles($dtype,$ptype,$spo);
return $count;
public function nodes() {
return $this->_nodes();
}
// $dtype is BACKUP or ARCHIVE
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStorageModeData($dtype,$ptype,$spo='') {
$count = 0;
/**
* Return the FILES that NODES in this DOMAIN has in a STORAGE POOL
* @param $pool is STORAGE POOL NAME
*/
public function file_bypool($pool) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$pool);
$c = Kohana::$config->load('config')->cache;
foreach ($this->NODE->find_all() as $no)
$count += $no->getStorageModeData($dtype,$ptype,$spo);
if (is_null($result = Cache::instance($c)->get($k))) {
$result = 0;
return $count;
foreach ($this->_nodes() as $no)
$result += $no->file_bypool($pool);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
// $dtype is BACKUP or ARCHIVE
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStorageModeNodes($dtype,$ptype,$spo='') {
return $result;
}
/**
* Return the LOGICAL_MB that NODES in this DOMAIN has in a STORAGE POOL
* @param $pool is STORAGE POOL NAME
*/
public function logmb_bypool($pool) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$pool);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = 0;
foreach ($this->_nodes() as $no)
$result += $no->logmb_bypool($pool);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the NODES in this DOMAIN that have data in this STORAGE POOL
* @param $pool is STORAGE POOL NAME
*/
public function nodes_bypool(ORM $spo) {
$result = array();
foreach ($this->NODE->find_all() as $no)
if ($no->getStorageModeData($dtype,$ptype,$spo))
foreach ($spo->nodes() as $no)
if (in_array($no,$this->_nodes()))
array_push($result,$no);
return $result;
}
/**
* Return the STORAGE POOLS used by NODES in this DOMAIN
*/
public function stgpools() {
$k = sprintf('%s-%s',__METHOD__,$this->DOMAIN_NAME);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->nodes() as $no)
foreach ($no->stgpools() as $spo)
if (! in_array($spo,$result))
array_push($result,$spo);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the STORAGE POOL TYPES used by NODES in this DOMAIN
* ie: ACTIVE/PRIMARY/COPY
* @todo This should be sorted by PRIMARY/ACTIVE/COPY
*/
public function stgpooltypes() {
$k = sprintf('%s-%s',__METHOD__,$this->DOMAIN_NAME);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->stgpools() as $spo)
if (! in_array($spo->POOLTYPE,$result))
array_push($result,$spo->POOLTYPE);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the STORAGE POOLS that NODES in this DOMAIN uses by BACKUP TYPE
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function stgpools_bybtype($type) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$type);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_nodes() as $no)
foreach ($no->stgpools_bybtype($type) as $spo)
if (! in_array($spo->STGPOOL_NAME,$result))
array_push($result,$spo);
Sort::MASort($result,'STGPOOL_NAME');
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the STORAGE POOLS that NODES in this DOMAIN uses by BACKUP TYPE
* @param $type is ACTIVEDATA/PRIMARY/COPY
*/
public function stgpools_byptype($type) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$type);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->stgpools() as $spo)
if ($spo->POOLTYPE == $type)
array_push($result,$spo);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the VOLUMES that NODES in this DOMAIN use
* @param $pool is STORAGE POOL NAME
*/
public function vols_bypool($pool) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$pool);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_nodes() as $no)
foreach ($no->vols_bypool($pool) as $vuo)
if (! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo);
array_push($x,$vuo->VOLUME_NAME);
}
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the VOLUMES that NODES in this DOMAIN uses by BACKUP TYPE
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function vols_bybtype($type) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->DOMAIN_NAME,$type);
$c = Kohana::$config->load('config')->cache;
if (TRUE OR is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_nodes() as $no)
foreach ($no->vols_bybtype($type) as $vuo)
if (! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo);
array_push($x,$vuo->VOLUME_NAME);
}
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the VOLUMES that this NODE uses by pool and BACKUP TYPE
* @param $pool is STORAGE POOL NAME
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function vols_bypoolbybtype($pool,$type) {
$x = $result = array();
foreach ($this->vols_bypool($pool) as $vuo)
if ($vuo->COPY_TYPE == $type AND ! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo);
array_push($x,$vuo->VOLUME_NAME);
}
return $result;
}
}
?>

View File

@ -16,8 +16,6 @@ class Model_DRIVE extends TSM_ORM {
'DRIVE_NAME'=>'ASC',
);
protected $_has_one = array(
);
protected $_has_many = array(
'PATH'=>array('foreign_key'=>array('LIBRARY_NAME'=>'LIBRARY_NAME','DRIVE_NAME'=>'DESTINATION_NAME')),
);

View File

@ -21,9 +21,6 @@ class Model_FILESPACE extends TSM_ORM {
'NODE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
);
protected $_has_many = array(
);
protected $_tsm = array(
'db2'=>array(
'_primary_key'=>'FSNAME',

View File

@ -20,14 +20,13 @@ class Model_LIBRARY extends TSM_ORM {
private $slots;
private $storagepools = array();
protected $_has_one = array(
);
protected $_has_many = array(
'DRIVE'=>array('foreign_key'=>'LIBRARY_NAME','far_key'=>'LIBRARY_NAME'),
'PATH'=>array('foreign_key'=>'DESTINATION_NAME','far_key'=>'LIBRARY_NAME'),
'DEVCLASSES'=>array('foreign_key'=>'LIBRARY_NAME','far_key'=>'LIBRARY_NAME'),
);
#zz
public function slots() {
return $this->slots ? $this->slots : $this->slots = DB::query(Database::SHOW,'SHOW SLOTS '.$this)->execute(Kohana::$config->load('config')->client_type);
}

View File

@ -16,11 +16,6 @@ class Model_MEDIA extends TSM_ORM {
'VOLUME_NAME'=>'ASC',
);
protected $_has_one = array(
);
protected $_has_many = array(
);
public function inlib() {
return in_array($this->STATE,array('MOUNTABLEINLIB','Mountable in library'));
}

View File

@ -114,16 +114,68 @@ class Model_NODE extends TSM_ORM {
),
);
// Pools used by a node.
private $pools = array();
/**
* Get all the FILESPACES for this NODE
*/
private function _filespaces() {
$result = array();
public function tsmclientversion() {
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('FILESPACE')->find_all() as $o)
if ($o->NODE_NAME == $this->NODE_NAME)
array_push($result,$o);
return $result;
}
/**
* Get all the OCCUPANCY for this NODE
*/
private function _occupancy() {
$result = array();
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('OCC')->find_all() as $o)
if ($o->NODE_NAME == $this->NODE_NAME)
array_push($result,$o);
return $result;
}
/**
* Get all the VOLUMES for this NODE
*/
private function _volumeusage() {
$result = array();
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('VOLUMEUSAGE')->find_all() as $o)
if ($o->NODE_NAME == $this->NODE_NAME)
array_push($result,$o);
return $result;
}
public function fs() {
return $this->_filespaces();
}
/**
* Return the version of the TSM client
*/
public function version() {
if ($this->CLIENT_VERSION)
return sprintf('%s.%s.%s.%s',$this->CLIENT_VERSION,$this->CLIENT_RELEASE,$this->CLIENT_LEVEL,$this->CLIENT_SUBLEVEL);
else
return '';
}
/**
* Return the OS version for the TSM client
*/
public function platform() {
return sprintf('%s %s',$this->PLATFORM_NAME,$this->CLIENT_OS_LEVEL ? '('.$this->CLIENT_OS_LEVEL.')' : '');
}
@ -136,10 +188,13 @@ class Model_NODE extends TSM_ORM {
return _('No Set');
}
// @todo This needs to be validated as a correct calculation
public function lasttransferpercent() {
return 100-($this->LASTSESS_IDLEWAIT+$this->LASTSESS_COMMWAIT+$this->LASTSESS_MEDIAWAIT);
$x = 100-($this->LASTSESS_IDLEWAIT+$this->LASTSESS_COMMWAIT+$this->LASTSESS_MEDIAWAIT);
return $x < 0 ? 0 : $x;
}
// @todo This needs to be validated as a correct calculation
public function lasttransfertime() {
if ($this->LASTSESS_DURATION)
return $this->LASTSESS_DURATION*($this->lasttransferpercent()/100);
@ -147,6 +202,7 @@ class Model_NODE extends TSM_ORM {
return 0;
}
// @todo This needs to be validated as a correct calculation
public function lastsendperformance() {
if ($this->lasttransfertime())
return $this->LASTSESS_SENT/$this->lasttransfertime()/1024/1024;
@ -154,6 +210,7 @@ class Model_NODE extends TSM_ORM {
return 0;
}
// @todo This needs to be validated as a correct calculation
public function lastreceiveperformance() {
if ($this->lasttransfertime())
return $this->LASTSESS_RECVD/$this->lasttransfertime()/1024/1024;
@ -161,6 +218,9 @@ class Model_NODE extends TSM_ORM {
return 0;
}
/**
* The last sent aggregate performance
*/
public function lastsendaggperformance() {
if ((real)$this->LASTSESS_DURATION)
return $this->LASTSESS_SENT/$this->LASTSESS_DURATION/1024/1024;
@ -168,6 +228,9 @@ class Model_NODE extends TSM_ORM {
return 0;
}
/**
* The last receive aggregate performance
*/
public function lastreceiveaggperformance() {
if ((real)$this->LASTSESS_DURATION)
return $this->LASTSESS_RECVD/$this->LASTSESS_DURATION/1024/1024;
@ -180,56 +243,20 @@ class Model_NODE extends TSM_ORM {
return $this->TXNGROUPMAX;
}
// Work out all the storage pools used by a node.
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
public function getStoragePools($dtype) {
return isset($this->pools[$dtype]) ? $this->pools[$dtype] : $this->_getpools($dtype);
}
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
private function _getpools($dtype) {
$this->pools[$dtype] = array();
foreach ($this->FILESPACE->find_all() as $fso)
foreach ($fso->storagepools($dtype) as $po)
if (! isset($this->pools[$dtype][$po->POOLTYPE][$po->STGPOOL_NAME]))
$this->pools[$dtype][$po->POOLTYPE][$po->STGPOOL_NAME] = $po;
return $this->pools[$dtype];
}
// Test to see if a node has any data of type
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
public function hasData($dtype) {
return $this->getStoragePools($dtype) ? TRUE : FALSE;
}
public function getAllStoragePoolsType($ptype) {
$result = array();
foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype)
$result = array_merge($result,$this->getStoragePoolsType($btype,$ptype));
return $result;
}
// Return the storage pools used for a backup type
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStoragePoolsType($dtype,$ptype) {
if (! isset($this->pools[$dtype]))
$this->_getpools($dtype);
return isset($this->pools[$dtype][$ptype]) ? $this->pools[$dtype][$ptype] : array();
// @param $type is BACKUP/ARCHIVE/SPACE MANAGED
public function hasData($type) {
return $this->vols_bybtype($type) ? TRUE : FALSE;
}
// $dtype is BACKUP or ARCHIVE
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
#zz
public function getStorageModeVols($dtype,$ptype,$spo='') {
$result = array();
foreach ($this->VOLUMEUSAGE->where('COPY_TYPE','=',$dtype)->find_all() as $vo)
if ((! $spo OR $vo->STGPOOL_NAME == $spo) AND $vo->STGPOOL->POOLTYPE == $ptype)
foreach ($this->_volumeusage() as $vo)
if ($vo->COPY_TYPE == $dtype AND (! $spo OR $vo->STGPOOL_NAME == $spo) AND $vo->STGPOOL->POOLTYPE == $ptype)
if (! isset($result[$vo->VOLUME_NAME]))
$result[$vo->VOLUME_NAME] = $vo;
@ -237,6 +264,7 @@ class Model_NODE extends TSM_ORM {
}
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
#zz
public function getStorageTypeVols($ptype,$spo='') {
$result = array();
@ -246,74 +274,243 @@ class Model_NODE extends TSM_ORM {
return $result;
}
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStorageModeFiles($dtype,$ptype,$spo='') {
$count = 0;
/**
* Return the data that this NODE has in a STORAGE POOL
* @param $pool is STORAGE POOL NAME
* @param $metric is metric of the storpage pool, eg: NUM_FILES
*/
private function data_bypool($pool,$metric) {
$k = sprintf('%s-%s-%s-%s',__METHOD__,$this->NODE_NAME,$pool,$metric);
$c = Kohana::$config->load('config')->cache;
foreach ($this->OCC->where('TYPE','=',$dtype)->find_all() as $oa)
if ((! $spo OR $oa->STGPOOL_NAME == $spo) AND $oa->STGPOOL->POOLTYPE == $ptype)
$count += $oa->NUM_FILES;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = 0;
return $count;
foreach ($this->_occupancy() as $oo)
if ($oo->STGPOOL_NAME == $pool)
$result += $oo->{$metric};
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStorageTypeFiles($ptype,$spo='') {
$count = 0;
foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype)
$count += $this->getStorageModeFiles($btype,$ptype,$spo);
return $count;
}
// $dtype is BACKUP (Bkup) or ARCHIVE (Arch)
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStorageModeData($dtype,$ptype,$spo='') {
$count = 0;
foreach ($this->OCC->where('TYPE','=',$dtype)->find_all() as $oa)
if ((! $spo OR $oa->STGPOOL_NAME == $spo) AND $oa->STGPOOL->POOLTYPE == $ptype)
$count += $oa->LOGICAL_MB;
return $count;
}
// $ptype is pool type (PRIMARY,ACTIVE,COPY)
public function getStorageTypeData($ptype,$spo='') {
$count = 0;
foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype)
$count += $this->getStorageModeData($btype,$ptype,$spo);
return $count;
}
// Return the volumes that this node uses
// $dtype is BACKUP or ARCHIVE
public function volumes($dtype) {
$volumes = array();
$v = array();
foreach ($this->VOLUMEUSAGE->where('COPY_TYPE','=',$dtype)->order_by('STGPOOL_NAME,FILESPACE_NAME')->find_all() as $vol)
if (! in_array($vol->VOLUME->VOLUME_NAME,$v)) {
$volumes[$vol->STGPOOL_NAME][] = $vol->VOLUME;
array_push($v,$vol->VOLUME->VOLUME_NAME);
}
return $volumes;
return $result;
}
/**
* Get all the nodes by OS
* Return the FILES that this NODE has in a STORAGE POOL
* @param $pool is STORAGE POOL NAME
*/
public function byos() {
$a = $this->select('count(*) AS node_name,platform_name')
->group_by('platform_name')
->order_by('platform_name');
public function file_bypool($pool) {
return $this->data_bypool($pool,'NUM_FILES');
}
return $a->find_all();
/**
* Return the FILES that this NODE has in a STORAGE POOL TYPE
* @param $type is ACTIVEDATA/PRIMARY/COPY
*/
public function file_byptype($type) {
$result = 0;
foreach ($this->stgpools_byptype($type) as $spo)
$result += $this->file_bypool($spo);
return $result;
}
/**
* Return the LOGICAL_MB that this NODE has in a STORAGE POOL
* @param $pool is STORAGE POOL NAME
*/
public function logmb_bypool($pool) {
return $this->data_bypool($pool,'LOGICAL_MB');
}
/**
* Return the FILES that this NODE has in a STORAGE POOL TYPE
* @param $type is ACTIVEDATA/PRIMARY/COPY
*/
public function logmb_byptype($type) {
$result = 0;
foreach ($this->stgpools_byptype($type) as $spo)
$result += $this->logmb_bypool($spo);
return $result;
}
/**
* Return the STORAGE POOLS this NODE has data in
*/
public function stgpools() {
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_volumeusage() as $vuo)
if (! in_array($vuo->STGPOOL_NAME,$x)) {
array_push($result,$vuo->STGPOOL);
array_push($x,$vuo->STGPOOL_NAME);
}
Sort::MASort($result,'STGPOOL_NAME');
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the STORAGE POOL TYPES used by this NODE
* ie: ACTIVE/PRIMARY/COPY
* @todo This should be sorted by PRIMARY/ACTIVE/COPY
*/
public function stgpooltypes() {
$k = sprintf('%s-%s',__METHOD__,$this->NODE_NAME);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->stgpools() as $spo)
if (! in_array($spo->POOLTYPE,$result))
array_push($result,$spo->POOLTYPE);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the STORAGE POOLS that this NODE uses by BACKUP TYPE
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function stgpools_bybtype($type) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_volumeusage() as $vuo)
if ($vuo->COPY_TYPE == $type AND ! in_array($vuo->STGPOOL_NAME,$x)) {
array_push($result,$vuo->STGPOOL);
array_push($x,$vuo->STGPOOL_NAME);
}
Sort::MASort($result,'STGPOOL_NAME');
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the STORAGE POOLS that this NODE uses by BACKUP TYPE
* @param $type is ACTIVEDATA/PRIMARY/COPY
*/
public function stgpools_byptype($type) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->stgpools() as $spo)
if ($spo->POOLTYPE == $type)
array_push($result,$spo);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the VOLUMES that this NODE uses by BACKUP TYPE
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function vols_bybtype($type) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$type);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_volumeusage() as $vuo)
if ($vuo->COPY_TYPE == $type AND ! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo->VOLUME);
array_push($x,$vuo->VOLUME_NAME);
}
Sort::MASort($result,'VOLUME_NAME');
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the VOLUMES that this NODE uses
* @param $pool is STORAGE POOL NAME
*/
public function vols_bypool($pool) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->NODE_NAME,$pool);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_volumeusage() as $vuo) {
if ($vuo->STGPOOL_NAME == $pool AND ! in_array($vuo->VOLUME_NAME,$x))
array_push($result,$vuo);
array_push($x,$vuo->VOLUME_NAME);
}
Sort::MASort($result,'VOLUME_NAME');
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Return the VOLUMES that this NODE has in a STORAGE POOL TYPE
* @param $type is ACTIVEDATA/PRIMARY/COPY
*/
public function vols_byptype($type) {
$result = array();
foreach ($this->stgpools_byptype($type) as $spo)
$result = array_merge($result,$this->vols_bypool($spo));
return $result;
}
/**
* Return the VOLUMES that this NODE uses by pool and BACKUP TYPE
* @param $pool is STORAGE POOL NAME
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function vols_bypoolbybtype($pool,$type) {
$x = $result = array();
foreach ($this->vols_bypool($pool) as $vuo)
if ($vuo->COPY_TYPE == $type AND ! in_array($vuo->VOLUME_NAME,$x)) {
array_push($result,$vuo);
array_push($x,$vuo->VOLUME_NAME);
}
return $result;
}
}
?>

View File

@ -20,6 +20,7 @@ class Model_OCC extends TSM_ORM {
);
protected $_has_one = array(
'NODE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'NODE_NAME'),
'STGPOOL'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
);
}

View File

@ -15,10 +15,5 @@ class Model_PATH extends TSM_ORM {
protected $_sorting = array(
'DESTINATION_NAME'=>'ASC',
);
protected $_has_one = array(
);
protected $_has_many = array(
);
}
?>

View File

@ -27,6 +27,43 @@ class Model_STGPOOL extends TSM_ORM {
'OCC'=>array('foreign_key'=>'STGPOOL_NAME','far_key'=>'STGPOOL_NAME'),
);
/**
* Get all the OCCUPANCY for this STORAGE POOL
*/
private function _occupancy() {
$result = array();
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('OCC')->find_all() as $o)
if ($o->STGPOOL_NAME == $this->STGPOOL_NAME)
array_push($result,$o);
return $result;
}
/**
* Get all the NODES for this STORAGE POOL
*/
public function nodes() {
$k = sprintf('%s-%s',__METHOD__,$this->STGPOOL_NAME);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
// @todo This might want to return the NODE object.
foreach ($this->_occupancy() as $oo)
if (! in_array($oo->NODE_NAME,$result))
array_push($result,$oo->NODE_NAME);
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
// Return a list of volumes
// @param $inout IN|OUT of the library
// @param $status volume status FULL|FILLING|PENDING|EMPTY

View File

@ -20,8 +20,6 @@ class Model_VOLHISTORY extends TSM_ORM {
'LIBVOLUME'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
'VOLUME'=>array('foreign_key'=>'VOLUME_NAME','far_key'=>'VOLUME_NAME'),
);
protected $_has_many = array(
);
protected $_display_filters = array(
'DATE_TIME'=>array(

View File

@ -34,26 +34,72 @@ class Model_VOLUME extends TSM_ORM {
),
);
// Show the number of filespaces on a volume
// $dtype is BACKUP or ARCHIVE
public function getFSOnVol($dtype) {
return $this->VOLUMEUSAGE->where('COPY_TYPE','=',$dtype)->find_all()->count();
/**
* Get all the VOLUMEUSAGE for this VOLUME
*/
private function _volumeusage() {
$result = array();
// In the interest of performance, we load all the records and get PHP to process it.
// Our ORM caching we reduce the hit on TSM.
foreach (ORM::factory('VOLUMEUSAGE')->find_all() as $o)
if ($o->VOLUME_NAME == $this->VOLUME_NAME)
array_push($result,$o);
return $result;
}
// Show the number of nodes on a volume
// $dtype is BACKUP or ARCHIVE
public function getNodesOnVol($dtype) {
return $this->VOLUMEUSAGE->select('NODE_NAME')->distinct(TRUE)->where('COPY_TYPE','=',$dtype)->find_all()->count();
/**
* Get FILESYSTEMS on a VOLUME
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function fs_bybtype($type) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->VOLUME_NAME,$type);
$c = Kohana::$config->load('config')->cache;
if (is_null($result = Cache::instance($c)->get($k))) {
$result = array();
foreach ($this->_volumeusage() as $vuo)
if ($vuo->COPY_TYPE == $type)
array_push($result,$vuo);
Sort::MASort($result,'VOLUME_NAME');
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
/**
* Get NODES on a VOLUME
* @param $type is BACKUP/ARCHIVE/SPACE MANAGED
*/
public function nodes_bybtype($type) {
$k = sprintf('%s-%s-%s',__METHOD__,$this->VOLUME_NAME,$type);
$c = Kohana::$config->load('config')->cache;
if (TRUE OR is_null($result = Cache::instance($c)->get($k))) {
$x = $result = array();
foreach ($this->_volumeusage() as $vuo)
if ($vuo->COPY_TYPE == $type AND ! in_array($vuo->NODE_NAME,$x)) {
array_push($result,$vuo);
array_push($x,$vuo->NODE_NAME);
}
// @todo Cache time should be configurble
Cache::instance($c)->set($k,$result,300);
}
return $result;
}
public function isScratch() {
return $this->SCRATCH === 'YES' ? TRUE : FALSE;
}
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) OR $this->STATUS == 'EMPTY')

View File

@ -14,8 +14,6 @@ class Model_VOLUMEUSAGE extends TSM_ORM {
protected $_primary_key = 'NODE_NAME'; // We need a primary key to detect that the object is loaded.
protected $_sorting = array(
'NODE_NAME'=>'ASC',
# 'FILESPACE_NAME'=>'ASC', // @todo Disabled, as we were getting some SQL errors, when the query returned no records
# 'VOLUME_NAME'=>'ASC',
);
protected $_has_one = array(

View File

@ -51,16 +51,15 @@ abstract class TSM_ORM extends ORM {
public function __get($column) {
// Get a substited column name - need for DB2/DSMADMC schema differences
if (isset($this->_tsm[$this->_db_group]['translate']) AND array_key_exists($column,$this->_tsm[$this->_db_group]['translate'])) {
if (isset($this->_tsm[$this->_db_group]['translate']) AND array_key_exists($column,$this->_tsm[$this->_db_group]['translate']))
return is_null($c=$this->_tsm[$this->_db_group]['translate'][$column]) ? NULL : parent::__get($c);
}
else
return parent::__get($column);
}
public function find() {
// Check if we can preload our data and havent already done it
if ($time = $this->isCacheable() AND is_null(Cache::instance()->get($cache_key = 'PRELOAD:'.$this->_table_name))) {
if ($time = $this->isCacheable() AND is_null(Cache::instance(Kohana::$config->load('config')->cache)->get($cache_key = 'PRELOAD:'.$this->_table_name))) {
// Firstly set our cache, so that we dont get in a loop
Cache::instance()->set($cache_key,TRUE,$time-1);

View File

@ -12,6 +12,8 @@
return array(
'cache_type' => 'file',
'cache' => 'apc',
'cache_time' => 86400,
'client' => '/opt/tivoli/tsm/client/ba/bin/dsmadmc',
'client_type' => 'dsmadmc',
'client_errorlogname' => '/tmp/pta-tsm-errorlog.log',

View File

@ -1,29 +1,30 @@
<table width="100%">
<tr>
<td style="width: 100%; vertical-align: top;"><?php echo View::factory('domain/nodes')->set('o',$o); ?></td>
<td style="width: 100%; vertical-align: top;" colspan="2"><?php echo View::factory('domain/nodes')->set('o',$o); ?></td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
<td class="spacer" colspan="2">&nbsp;</td>
</tr>
<tr>
<td style="width: 100%; vertical-align: top;"><?php echo View::factory('domain/stgpools')->set('o',$o); ?></td>
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('domain/stgpool_summary')->set('o',$o); ?></td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
<td class="spacer" colspan="2">&nbsp;</td>
</tr>
<tr>
<td style="width: 100%; vertical-align: top;"><?php echo View::factory('domain/volumes')->set('o',$o); ?></td>
<td colspan="2"><?php echo View::factory('domain/volumes')->set('o',$o); ?></td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
<td class="spacer" colspan="2">&nbsp;</td>
</tr>
<tr>
<td style="width: 100%; vertical-align: top;"><?php echo View::factory('domain/policy')->set('o',$o); ?></td>
<td colspan="2"><?php echo View::factory('domain/policy')->set('o',$o); ?></td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
<td class="spacer" colspan="2">&nbsp;</td>
</tr>
<tr>
<td style="width: 100%; vertical-align: top;"><?php echo View::factory('domain/schedules')->set('o',$o); ?></td>
<td colspan="2"><?php echo View::factory('domain/schedules')->set('o',$o); ?></td>
</tr>
</table>

View File

@ -14,27 +14,27 @@
<td>Last IP Addr</td>
<td>Client Opt</td>
<?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<td><?php echo $ctype[0]; ?></td>
<td><?php echo substr($ctype,0,1); ?></td>
<?php } ?>
<?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<td colspan="3" class="right"><?php echo $type; ?>(Vol/Fil/Dat)</td>
<?php } ?>
</tr>
<?php $i=0; foreach ($o->NODE->find_all() as $no) { ?>
<?php $i=0; foreach ($o->nodes() as $no) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data"><abbr title="<?php printf('%s (%s)',$no->display('CONTACT'),$no->display('EMAIL_ADDRESS')); ?>"><?php echo HTML::anchor('node/detail/'.$no->NODE_NAME,$no->NODE_NAME); ?></abbr></td>
<td class="data"><?php echo $no->tsmclientversion(); ?></td>
<td class="data"><?php echo $no->version(); ?></td>
<td class="data"><?php echo $no->platform(); ?></td>
<td class="data"><?php echo $no->display('LASTACC_TIME'); ?></td>
<td class="data"><?php echo $no->display('TCP_ADDRESS'); ?></td>
<td class="data"><?php echo $no->display('OPTION_SET'); ?></td>
<?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<td class="data"><?php echo $no->hasData($btype) ? 'Y' : 'N'; ?></td>
<td class="data"><?php echo $no->hasData($ctype) ? 'Y' : 'N'; ?></td>
<?php } ?>
<?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<td class="data-right"><?php echo count($no->getStorageTypeVols($type)); ?></td>
<td class="data-right"><?php echo $no->getStorageTypeFiles($type); ?></td>
<td class="data-right"><?php echo $no->getStorageTypeData($type); ?></td>
<td class="data-right"><?php echo count($no->vols_byptype($type)); ?></td>
<td class="data-right"><?php echo number_format($no->file_byptype($type),0); ?></td>
<td class="data-right"><?php echo number_format($no->logmb_byptype($type),0); ?></td>
<?php } ?>
</tr>
<?php } ?>

View File

@ -0,0 +1,36 @@
<!-- $o = ORM::factory('DOMAIN') -->
<table class="box-full">
<tr>
<td class="head" colspan="15">Storage By Pools Summary for Nodes in this Domain</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Storage Pool and Type</td>
<td class="right">Scr Use</td>
<td class="right">Scr Avl</td>
<td class="right">Nodes</td>
<td class="right">Vols</td>
<td class="right">Files</td>
<td class="right">MB</td>
</tr>
<?php $i=0; foreach ($o->stgpooltypes() as $type) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td colspan="8" class="data"><?php echo $type; ?></td>
</tr>
<?php foreach ($o->stgpools_byptype($type) as $spo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td>&nbsp;</td>
<td class="data"><?php echo HTML::anchor('stgpool/detail/'.$spo->STGPOOL_NAME,$spo->display('STGPOOL_NAME')); ?></td>
<td class="data-right"><?php echo $spo->display('NUMSCRATCHUSED'); ?></td>
<td class="data-right"><?php echo $spo->display('MAXSCRATCH'); ?></td>
<td class="data-right"><?php echo count($o->nodes_bypool($spo)); ?></td>
<td class="data-right"><?php echo count($o->vols_bypool($spo)); ?></td>
<td class="data-right"><?php echo number_format($o->file_bypool($spo),0); ?></td>
<td class="data-right"><?php echo number_format($o->logmb_bypool($spo),0); ?></td>
</tr>
<?php } ?>
<?php } ?>
</table>

View File

@ -1,53 +0,0 @@
<!-- $o = ORM::factory('DOMAIN') -->
<table class="box-full">
<tr>
<td class="head" colspan="15">Storage Pools used by nodes in this Domain</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td colspan="3">Storage Pool</td>
<td class="right">Scr Use</td>
<td class="right">Scr Avl</td>
<td class="right">Access</td>
<td class="right">Rec %</td>
<td class="right">Util %</td>
<td class="right">Migr %</td>
<td class="right">High/Low</td>
<td class="right">Next</td>
<td class="right">Nodes</td>
<td class="right">Vols</td>
<td class="right">Files</td>
<td class="right">MB</td>
</tr>
<?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<tr class="subhead">
<td colspan="15"><?php echo $btype; ?></td>
</tr>
<?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<tr class="subhead">
<td>&nbsp;</td>
<td colspan="14"><?php echo $type; ?></td>
</tr>
<?php $i=0; foreach ($o->getStoragePoolsType($btype,$type) as $spo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td colspan="2">&nbsp;</td>
<td class="data"><?php echo HTML::anchor('stgpool/detail/'.$spo->STGPOOL_NAME,$spo->display('STGPOOL_NAME')); ?></td>
<td class="data-right"><?php echo $spo->display('NUMSCRATCHUSED'); ?></td>
<td class="data-right"><?php echo $spo->display('MAXSCRATCH'); ?></td>
<td class="data-right"><?php echo $spo->display('ACCESS'); ?></td>
<td class="data-right"><?php echo $spo->display('RECLAIM'); ?></td>
<td class="data-right"><?php echo $spo->display('PCT_UTILIZED'); ?></td>
<td class="data-right"><?php echo $spo->display('PCT_MIGR'); ?></td>
<td class="data-right"><?php printf('%s/%s',$spo->HIGHMIG,$spo->LOWMIG); ?></td>
<td class="data-right"><?php echo $spo->NEXTSTGPOOL ? HTML::anchor('stgpool/detail/'.$spo->NEXTSTGPOOL,$spo->display('NEXTSTGPOOL')) : '&nbsp;'; ?></td>
<td class="data-right"><?php echo count($o->getStorageModeNodes($btype,$type,$spo)); ?></td>
<td class="data-right"><?php echo count($o->getStorageModeVols($ctype,$type,$spo)); ?></td>
<td class="data-right"><?php echo $o->getStorageModeFiles($btype,$type,$spo); ?></td>
<td class="data-right"><?php echo $o->getStorageModeData($btype,$type,$spo); ?></td>
</tr>
<?php } ?>
<?php } ?>
<?php } ?>
</table>

View File

@ -1,55 +1,51 @@
<!-- $o = ORM::factory('DOMAIN') -->
<table width="100%">
<?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<tr>
<td style="width: 100%; vertical-align: top;">
<table class="box-full">
<tr>
<td class="head" colspan="14">Sequential Volumes needed to restore Data for Nodes in this Domain</td>
<td class="head" colspan="2"><?php echo $ctype.' '._('Volumes'); ?></td>
</tr>
<?php if ($o->vols_bybtype($ctype)) { ?>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td colspan="4">Volume</td>
<td>Status</td>
<td>Volume</td>
<td>Last Read Date</td>
<td>Last Write Date</td>
<td>Access</td>
<td>Scr</td>
<td class="right">Pct %</td>
<td class="right">Rec %</td>
<td class="right">Mounted</td>
<td class="right">R/W Err</td>
<td>Status</td>
<td class="right">Errors R/W</td>
<td class="right">Util %</td>
<td class="right">Recl %</td>
<td class="right">FS</td>
<td class="right">Nodes</td>
<td class="right">Location</td>
</tr>
<?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<tr class="subhead">
<td colspan="14"><?php echo $btype; ?></td>
</tr>
<?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<tr class="subhead">
<td>&nbsp;</td>
<td colspan="13"><?php echo $type; ?></td>
</tr>
<?php $i=0;foreach ($o->getStoragePoolsType($btype,$type) as $spo) { ?>
<tr class="subhead">
<td colspan="2">&nbsp;</td>
<td colspan="13"><?php echo $spo->DISPLAY('STGPOOL_NAME'); ?></td>
</tr>
<?php foreach ($o->getStorageModeVols($ctype,$type,$spo) as $vuo) { ?>
<?php $i=0; foreach ($o->stgpools_bybtype($ctype) as $spo) { ?>
<tr class="subhead"><td colspan="10"><?php printf('%s: Reclaim: %s%%, Scratch Usage: %s/%s, Device Type: %s',$spo->STGPOOL_NAME,$spo->RECLAIM,$spo->NUMSCRATCHUSED,$spo->MAXSCRATCH,$spo->DEVCLASSES->DEVTYPE); ?></td></tr>
<?php foreach ($o->vols_bypoolbybtype($spo->STGPOOL_NAME,$ctype) as $vuo) {
$vo = $vuo->VOLUME; ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td colspan="3">&nbsp;</td>
<td class="data"><?php echo HTML::anchor('volume/detail/'.$vuo->VOLUME_NAME,$vuo->display('VOLUME_NAME')); ?></td>
<td class="data"><?php echo $vuo->VOLUME->display('STATUS'); ?></td>
<td class="data"><?php echo $vuo->VOLUME->display('ACCESS'); ?></td>
<td class="data"><?php echo $vuo->VOLUME->isScratch() ? 'Y' : 'N'; ?></td>
<td class="data-right"><?php echo $vuo->VOLUME->display('PCT_UTILIZED'); ?></td>
<td class="data-right"><?php echo $vuo->VOLUME->display('PCT_RECLAIM'); ?></td>
<td class="data-right"><?php echo $vuo->VOLUME->display('TIMES_MOUNTED'); ?></td>
<td class="data-right"><?php printf('%s/%s',$vuo->VOLUME->READ_ERRORS,$vuo->VOLUME->WRITE_ERRORS); ?></td>
<td class="data-right"><?php echo $vuo->VOLUME->getFSOnVol($ctype); ?></td>
<td class="data-right"><?php echo $vuo->VOLUME->getNodesOnVol($ctype); ?></td>
<td class="data-right"><?php echo $vuo->VOLUME->location(); ?></td>
<td class="data"><?php echo HTML::anchor('volume/detail/'.$vo->VOLUME_NAME,$vo->display('VOLUME_NAME')); ?></td>
<td class="data"><?php echo $vo->display('LAST_READ_DATE'); ?></td>
<td class="data"><?php echo $vo->display('LAST_WRITE_DATE'); ?></td>
<td class="data"><?php echo $vo->display('ACCESS'); ?></td>
<td class="data"><?php echo $vo->display('STATUS'); ?></td>
<td class="data-right"><?php printf('%s/%s',$vo->READ_ERRORS,$vo->WRITE_ERRORS); ?></td>
<td class="data-right"><?php echo $vo->display('PCT_UTILIZED'); ?></td>
<td class="data-right"><?php echo $vo->display('PCT_RECLAIM'); ?></td>
<td class="data-right"><?php echo count($vo->fs_bybtype($ctype)); ?></td>
<td class="data-right"><?php echo count($vo->nodes_bybtype($ctype)); ?></td>
</tr>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } else { ?>
<tr><td><?php echo _('There are NO volumes for this Domain.'); ?></td></tr>
<?php } ?>
</table>
</td>
</tr>
<?php } ?>
</table>

View File

@ -7,7 +7,7 @@
<tr>
<td class="head" colspan="2"><?php echo $ctype; ?> Information</td>
</tr>
<?php if ($o->getStoragePools($btype)) { ?>
<?php if ($o->vols_bybtype($ctype)) { ?>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
@ -15,21 +15,17 @@
<td>File Space</td>
<td><?php echo ($btype == 'Bkup') ? 'Last Date' : '&nbsp'; ?></td>
<td class="right">Utilisation</td>
<?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type)
if (count($pools = $o->getStoragePoolsType($btype,$type)))
foreach ($pools as $pool_name) { ?>
<td class="right"><?php echo $pool_name; ?> <span style="vertical-align: super; font-size: 60%;"><?echo $type; ?></span></td>
<?php foreach ($o->stgpools() as $spo) { ?>
<td class="right"><?php echo $spo->display('STGPOOL_NAME'); ?> <span style="vertical-align: super; font-size: 60%;"><?php echo $spo->display('POOLTYPE'); ?></span></td>
<?php } ?>
</tr>
<?php $i=0;foreach ($o->FILESPACE->find_all() as $fso) { ?>
<?php $i=0; foreach ($o->fs() as $fso) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data"><?php echo $fso->display('FILESPACE_NAME'); ?></td>
<td class="data"><?php echo ($btype == 'Bkup') ? $fso->display('BACKUP_END') : '&nbsp;'; ?></td>
<td class="data-right"><?php echo number_format($fso->utilsation(),2); ?></td>
<?php foreach (Kohana::$config->load('config')->tsmpooltypes as $type)
if (count($pools = $o->getStoragePoolsType($btype,$type)))
foreach ($pools as $pool_name) { ?>
<td class="data-right"><?php echo number_format($fso->pool_logical_util($pool_name,$btype),2); ?> (<?php echo $fso->pool_numvols($pool_name,$ctype); ?>)</td>
<?php foreach ($o->stgpools() as $spo) { ?>
<td class="data-right"><?php echo number_format($fso->pool_logical_util($spo->STGPOOL_NAME,$btype),2); ?> (<?php echo $fso->pool_numvols($spo->STGPOOL_NAME,$ctype); ?>)</td>
<?php } ?>
</tr>
<?php } ?>

View File

@ -20,7 +20,7 @@
</tr>
<tr>
<td>TSM Client Version</td>
<td class="data"><?php echo $o->tsmclientversion(); ?></td>
<td class="data"><?php echo $o->version(); ?></td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>

View File

@ -1,31 +1,31 @@
<!-- $o = ORM::factory('NODE') -->
<table class="box-full">
<tr>
<td class="head" colspan="2">Storage Summary</td>
<td class="head" colspan="2">Storage By Pool Summary</td>
</tr>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
<tr>
<td colspan="2">Storage Type</td>
<td colspan="2">Storage Pool and Type</td>
<td class="right">Vols</td>
<td class="right">Files</td>
<td class="right">MB</td>
</tr>
<?php $i=0; foreach (Kohana::$config->load('config')->tsmpooltypes as $type) { ?>
<?php $i=0; foreach ($o->stgpooltypes() 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($o->getStorageTypeVols($type)); ?></td>
<td class="data-right"><?php echo $o->getStorageTypeFiles($type); ?></td>
<td class="data-right"><?php echo $o->getStorageTypeData($type); ?></td>
<td class="data-right"><?php echo number_format($o->file_byptype($type),0); ?></td>
<td class="data-right"><?php echo number_format($o->logmb_byptype($type),0); ?></td>
</tr>
<?php foreach ($o->getAllStoragePoolsType($type) as $spo) { ?>
<?php foreach ($o->stgpools_byptype($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($o->getStorageTypeVols($type,$spo)); ?></td>
<td class="right"><?php echo $o->getStorageTypeFiles($type,$spo); ?></td>
<td class="right"><?php echo $o->getStorageTypeData($type,$spo); ?></td>
<td class="right"><?php echo count($o->vols_bypool($spo)); ?></td>
<td class="right"><?php echo number_format($o->file_bypool($spo),0); ?></td>
<td class="right"><?php echo number_format($o->logmb_bypool($spo),0); ?></td>
</tr>
<?php } ?>
<?php } ?>

View File

@ -7,7 +7,7 @@
<tr>
<td class="head" colspan="2"><?php echo $ctype.' '._('Volumes'); ?></td>
</tr>
<?php if ($o->volumes($ctype)) { ?>
<?php if ($o->vols_bybtype($ctype)) { ?>
<tr>
<td class="spacer">&nbsp;</td>
</tr>
@ -19,14 +19,14 @@
<td>Status</td>
<td class="right">Errors R/W</td>
<td class="right">Util %</td>
<td class="right">Reclaim</td>
<td class="right">Recl %</td>
<td class="right">Other FS</td>
<td class="right">Other Node</td>
</tr>
<?php $i=0; foreach ($o->volumes($ctype) as $stgpool => $vols) {
$spo = ORM::factory('STGPOOL',$stgpool); ?>
<?php $i=0; foreach ($o->stgpools_bybtype($ctype) as $spo) { ?>
<tr class="subhead"><td colspan="10"><?php printf('%s: Reclaim: %s%%, Scratch Usage: %s/%s, Device Type: %s',$spo->STGPOOL_NAME,$spo->RECLAIM,$spo->NUMSCRATCHUSED,$spo->MAXSCRATCH,$spo->DEVCLASSES->DEVTYPE); ?></td></tr>
<?php foreach ($vols as $vo) { ?>
<?php foreach ($o->vols_bypoolbybtype($spo->STGPOOL_NAME,$ctype) as $vuo) {
$vo = $vuo->VOLUME; ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data"><?php echo HTML::anchor('volume/detail/'.$vo->VOLUME_NAME,$vo->display('VOLUME_NAME')); ?></td>
<td class="data"><?php echo $vo->display('LAST_READ_DATE'); ?></td>
@ -34,10 +34,10 @@
<td class="data"><?php echo $vo->display('ACCESS'); ?></td>
<td class="data"><?php echo $vo->display('STATUS'); ?></td>
<td class="data-right"><?php printf('%s/%s',$vo->READ_ERRORS,$vo->WRITE_ERRORS); ?></td>
<td class="data-right"><?php echo $vo->display('EST_CAPACITY_MB'); ?></td>
<td class="data-right"><?php echo $vo->display('PCT_UTILIZED'); ?></td>
<td class="data-right"><?php echo $vo->display('PCT_RECLAIM'); ?></td>
<td class="data-right"><?php echo $vo->getFSOnVol($ctype); ?></td>
<td class="data-right"><?php echo $vo->getNodesOnVol($ctype); ?></td>
<td class="data-right"><?php echo count($vo->fs_bybtype($ctype))-1; ?></td>
<td class="data-right"><?php echo count($vo->nodes_bybtype($ctype))-1; ?></td>
</tr>
<?php } ?>
<?php } ?>
@ -46,9 +46,6 @@
<?php } ?>
</table>
</td>
<td style="width: 50%; vertical-align: top;">
&nbsp;
</td>
</tr>
<?php } ?>
</table>

View File

@ -31,8 +31,8 @@
<td class="data-right"><abbr title="<?php echo $vo->display('EST_CAPACITY_MB'); ?>"><?php echo $vo->display('PCT_UTILIZED'); ?></abbr></td>
<td class="data-right"><?php echo $vo->display('PCT_RECLAIM'); ?></td>
<?php foreach (Kohana::$config->load('config')->tsmdatatypes as $btype => $ctype) { ?>
<td class="data-right"><?php echo $vo->getFSOnVol($ctype); ?></td>
<td class="data-right"><?php echo $vo->getNodesOnVol($ctype); ?></td>
<td class="data-right"><?php echo count($vo->fs_bybtype($ctype)); ?></td>
<td class="data-right"><?php echo count($vo->nodes_bybtype($ctype)); ?></td>
<?php } ?>
</tr>
<?php } ?>

132
index.php
View File

@ -1,11 +1,131 @@
<?php
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/index.php,v 1.3 2008/01/13 08:42:37 wurley Exp $
/**
* @package leenooksApp
* The directory in which your application specific resources are located.
* The application directory must contain the bootstrap.php file.
*
* @link http://kohanaframework.org/guide/about.install#application
*/
$application = 'application';
/**
* The directory in which your modules are located.
*
* @link http://kohanaframework.org/guide/about.install#modules
*/
$modules = 'modules';
/**
* The directory in which upstream Kohana resources (modules) are located.
*/
$sysmodules = 'includes/kohana/modules';
/**
* The directory in which the Kohana resources are located. The system
* directory must contain the classes/kohana.php file.
*
* @link http://kohanaframework.org/guide/about.install#system
*/
$system = 'includes/kohana/system';
/**
* The default extension of resource files. If you change this, all resources
* must be renamed to use the new extension.
*
* @link http://kohanaframework.org/guide/about.install#ext
*/
define('EXT', '.php');
/**
* Set the PHP error reporting level. If you set this in php.ini, you remove this.
* @link http://www.php.net/manual/errorfunc.configuration#ini.error-reporting
*
* When developing your application, it is highly recommended to enable notices
* and strict warnings. Enable them by using: E_ALL | E_STRICT
*
* In a production environment, it is safe to ignore notices and strict warnings.
* Disable them by using: E_ALL ^ E_NOTICE
*
* When using a legacy application with PHP >= 5.3, it is recommended to disable
* deprecated notices. Disable with: E_ALL & ~E_DEPRECATED
*/
error_reporting(E_ALL | E_STRICT);
/**
* End of standard configuration! Changing any of the code below should only be
* attempted by those with a working knowledge of Kohana internals.
*
* @link http://kohanaframework.org/guide/using.configuration
*/
# You should secure your application by making the htdocs/ your docroot.
header('Location: htdocs/index.php');
die();
?>
// Set the full path to the docroot
define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);
// Make the application relative to the docroot, for symlink'd index.php
if ( ! is_dir($application) AND is_dir(DOCROOT.$application))
$application = DOCROOT.$application;
// Make the modules relative to the docroot, for symlink'd index.php
if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
$modules = DOCROOT.$modules;
// Make the system relative to the docroot, for symlink'd index.php
if ( ! is_dir($sysmodules) AND is_dir(DOCROOT.$sysmodules))
$sysmodules = DOCROOT.$sysmodules;
// Make the system relative to the docroot, for symlink'd index.php
if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
$system = DOCROOT.$system;
// Define the absolute paths for configured directories
define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
define('SMDPATH', realpath($sysmodules).DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
// Clean up the configuration vars
unset($application, $modules, $sysmodules, $system);
if (file_exists('install'.EXT))
{
// Load the installation check
return include 'install'.EXT;
}
/**
* Define the start time of the application, used for profiling.
*/
if ( ! defined('KOHANA_START_TIME'))
{
define('KOHANA_START_TIME', microtime(TRUE));
}
/**
* Define the memory usage at the start of the application, used for profiling.
*/
if ( ! defined('KOHANA_START_MEMORY'))
{
define('KOHANA_START_MEMORY', memory_get_usage());
}
// Bootstrap the application
require APPPATH.'bootstrap'.EXT;
if (PHP_SAPI == 'cli') // Try and load minion
{
class_exists('Minion_Task') OR die('Please enable the Minion module for CLI support.');
set_exception_handler(array('Minion_Exception', 'handler'));
Minion_Task::factory(Minion_CLI::options())->execute();
}
else
{
/**
* Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
* If no source is specified, the URI will be automatically detected.
*/
echo Request::factory(TRUE, array(), FALSE)
->execute()
->send_headers(TRUE)
->body();
}

131
kh.php
View File

@ -1,131 +0,0 @@
<?php
/**
* The directory in which your application specific resources are located.
* The application directory must contain the bootstrap.php file.
*
* @link http://kohanaframework.org/guide/about.install#application
*/
$application = 'application';
/**
* The directory in which your modules are located.
*
* @link http://kohanaframework.org/guide/about.install#modules
*/
$modules = 'modules';
/**
* The directory in which upstream Kohana resources (modules) are located.
*/
$sysmodules = 'includes/kohana/modules';
/**
* The directory in which the Kohana resources are located. The system
* directory must contain the classes/kohana.php file.
*
* @link http://kohanaframework.org/guide/about.install#system
*/
$system = 'includes/kohana/system';
/**
* The default extension of resource files. If you change this, all resources
* must be renamed to use the new extension.
*
* @link http://kohanaframework.org/guide/about.install#ext
*/
define('EXT', '.php');
/**
* Set the PHP error reporting level. If you set this in php.ini, you remove this.
* @link http://www.php.net/manual/errorfunc.configuration#ini.error-reporting
*
* When developing your application, it is highly recommended to enable notices
* and strict warnings. Enable them by using: E_ALL | E_STRICT
*
* In a production environment, it is safe to ignore notices and strict warnings.
* Disable them by using: E_ALL ^ E_NOTICE
*
* When using a legacy application with PHP >= 5.3, it is recommended to disable
* deprecated notices. Disable with: E_ALL & ~E_DEPRECATED
*/
error_reporting(E_ALL | E_STRICT);
/**
* End of standard configuration! Changing any of the code below should only be
* attempted by those with a working knowledge of Kohana internals.
*
* @link http://kohanaframework.org/guide/using.configuration
*/
// Set the full path to the docroot
define('DOCROOT', realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);
// Make the application relative to the docroot, for symlink'd index.php
if ( ! is_dir($application) AND is_dir(DOCROOT.$application))
$application = DOCROOT.$application;
// Make the modules relative to the docroot, for symlink'd index.php
if ( ! is_dir($modules) AND is_dir(DOCROOT.$modules))
$modules = DOCROOT.$modules;
// Make the system relative to the docroot, for symlink'd index.php
if ( ! is_dir($sysmodules) AND is_dir(DOCROOT.$sysmodules))
$sysmodules = DOCROOT.$sysmodules;
// Make the system relative to the docroot, for symlink'd index.php
if ( ! is_dir($system) AND is_dir(DOCROOT.$system))
$system = DOCROOT.$system;
// Define the absolute paths for configured directories
define('APPPATH', realpath($application).DIRECTORY_SEPARATOR);
define('MODPATH', realpath($modules).DIRECTORY_SEPARATOR);
define('SMDPATH', realpath($sysmodules).DIRECTORY_SEPARATOR);
define('SYSPATH', realpath($system).DIRECTORY_SEPARATOR);
// Clean up the configuration vars
unset($application, $modules, $sysmodules, $system);
if (file_exists('install'.EXT))
{
// Load the installation check
return include 'install'.EXT;
}
/**
* Define the start time of the application, used for profiling.
*/
if ( ! defined('KOHANA_START_TIME'))
{
define('KOHANA_START_TIME', microtime(TRUE));
}
/**
* Define the memory usage at the start of the application, used for profiling.
*/
if ( ! defined('KOHANA_START_MEMORY'))
{
define('KOHANA_START_MEMORY', memory_get_usage());
}
// Bootstrap the application
require APPPATH.'bootstrap'.EXT;
if (PHP_SAPI == 'cli') // Try and load minion
{
class_exists('Minion_Task') OR die('Please enable the Minion module for CLI support.');
set_exception_handler(array('Minion_Exception', 'handler'));
Minion_Task::factory(Minion_CLI::options())->execute();
}
else
{
/**
* Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
* If no source is specified, the URI will be automatically detected.
*/
echo Request::factory(TRUE, array(), FALSE)
->execute()
->send_headers(TRUE)
->body();
}