Updates to node display
This commit is contained in:
parent
d053493eeb
commit
8814447096
@ -94,7 +94,6 @@ class Database_TSM extends Database {
|
|||||||
|
|
||||||
$result = $this->query(Database::SELECT,'SELECT server_name,platform,version,release,level,sublevel FROM status');
|
$result = $this->query(Database::SELECT,'SELECT server_name,platform,version,release,level,sublevel FROM status');
|
||||||
|
|
||||||
//echo Kohana::debug($result);die();
|
|
||||||
if ($result)
|
if ($result)
|
||||||
return TSM::instance()->set($username,$password,$result);
|
return TSM::instance()->set($username,$password,$result);
|
||||||
else
|
else
|
||||||
@ -163,10 +162,15 @@ class Database_TSM extends Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function clear() {
|
||||||
|
$this->_query_msg_codes = array();
|
||||||
|
}
|
||||||
|
|
||||||
public function query($type, $sql, $as_object = FALSE, array $params = NULL)
|
public function query($type, $sql, $as_object = FALSE, array $params = NULL)
|
||||||
{
|
{
|
||||||
// Make sure the database is connected
|
// Make sure the database is connected
|
||||||
$this->_connection or $this->connect();
|
$this->_connection or $this->connect();
|
||||||
|
$this->clear();
|
||||||
|
|
||||||
if ( ! empty($this->_config['profiling']))
|
if ( ! empty($this->_config['profiling']))
|
||||||
{
|
{
|
||||||
@ -174,6 +178,10 @@ class Database_TSM extends Database {
|
|||||||
$benchmark = Profiler::start("Database ({$this->_instance})", $sql);
|
$benchmark = Profiler::start("Database ({$this->_instance})", $sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to escape any back slashes, since the exec will transpose them
|
||||||
|
// @todo Is there a better way of doing this?
|
||||||
|
$sql = str_replace('\\','\\\\',$sql);
|
||||||
|
|
||||||
// Execute the query
|
// Execute the query
|
||||||
$stderr = exec($this->_connection.'"'.$sql.'"',$stdout,$rc);
|
$stderr = exec($this->_connection.'"'.$sql.'"',$stdout,$rc);
|
||||||
|
|
||||||
@ -187,7 +195,7 @@ class Database_TSM extends Database {
|
|||||||
|
|
||||||
// If we got a no data code
|
// If we got a no data code
|
||||||
if (array_intersect($this->_query_msg_codes,$this->nodata_codes)) {
|
if (array_intersect($this->_query_msg_codes,$this->nodata_codes)) {
|
||||||
$result = array(0);
|
$result = array();
|
||||||
$rc = 0;
|
$rc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ class Database_TSM_Result extends Database_Result {
|
|||||||
// Return an object of given class name
|
// Return an object of given class name
|
||||||
$o = new $this->_as_object;
|
$o = new $this->_as_object;
|
||||||
|
|
||||||
return $o->_load_values($this->_rows[$this->_current_row]);
|
return $o->values($this->_rows[$this->_current_row]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
class Model_Auth_UserDefault extends Model_Auth_User {
|
class Model_Auth_UserDefault extends Model_Auth_User {
|
||||||
protected $_table_names_plural = FALSE;
|
protected $_table_names_plural = FALSE;
|
||||||
protected $_disable_wild_select = TRUE;
|
protected $_disable_wild_select = TRUE;
|
||||||
|
protected $_disable_join_table_name = TRUE;
|
||||||
|
protected $_disable_limit = TRUE;
|
||||||
|
|
||||||
// Validation rules
|
// Validation rules
|
||||||
protected $_rules = array(
|
protected $_rules = array(
|
||||||
|
@ -32,9 +32,9 @@ class Model_FILESPACE extends ORMTSM {
|
|||||||
public function storagepools($dtype) {
|
public function storagepools($dtype) {
|
||||||
$pool = array();
|
$pool = array();
|
||||||
|
|
||||||
foreach ($this->VOLUMEUSAGE
|
foreach ($this->OCCUPANCY
|
||||||
->select('STGPOOL_NAME')
|
->select('STGPOOL_NAME')
|
||||||
->where('COPY_TYPE','=',$dtype)
|
->where('TYPE','=',$dtype)
|
||||||
->group_by('STGPOOL_NAME')
|
->group_by('STGPOOL_NAME')
|
||||||
->order_by('STGPOOL_NAME')
|
->order_by('STGPOOL_NAME')
|
||||||
->find_all() as $vo) {
|
->find_all() as $vo) {
|
||||||
|
@ -52,29 +52,38 @@ class Model_NODE extends ORMTSM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function lasttransfertime() {
|
public function lasttransfertime() {
|
||||||
|
if ($this->LASTSESS_DURATION)
|
||||||
return $this->LASTSESS_DURATION*($this->lasttransferpercent()/100);
|
return $this->LASTSESS_DURATION*($this->lasttransferpercent()/100);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function lastsendperformance() {
|
public function lastsendperformance() {
|
||||||
if ($this->lasttransfertime())
|
if ($this->lasttransfertime())
|
||||||
return $this->LASTSESS_SENT/$this->lasttransfertime()/1024/1024;
|
return $this->LASTSESS_SENT/$this->lasttransfertime()/1024/1024;
|
||||||
else
|
else
|
||||||
return _('N/A');
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function lastreceiveperformance() {
|
public function lastreceiveperformance() {
|
||||||
if ($this->lasttransfertime())
|
if ($this->lasttransfertime())
|
||||||
return $this->LASTSESS_RECVD/$this->lasttransfertime()/1024/1024;
|
return $this->LASTSESS_RECVD/$this->lasttransfertime()/1024/1024;
|
||||||
else
|
else
|
||||||
return _('N/A');
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function lastsendaggperformance() {
|
public function lastsendaggperformance() {
|
||||||
|
if ((real)$this->LASTSESS_DURATION)
|
||||||
return $this->LASTSESS_SENT/$this->LASTSESS_DURATION/1024/1024;
|
return $this->LASTSESS_SENT/$this->LASTSESS_DURATION/1024/1024;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function lastreceiveaggperformance() {
|
public function lastreceiveaggperformance() {
|
||||||
|
if ((real)$this->LASTSESS_DURATION)
|
||||||
return $this->LASTSESS_RECVD/$this->LASTSESS_DURATION/1024/1024;
|
return $this->LASTSESS_RECVD/$this->LASTSESS_DURATION/1024/1024;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo This should return the system setting (cloptset), if the node setting is not configured.
|
// @todo This should return the system setting (cloptset), if the node setting is not configured.
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class overrides the Kohana ORM for some TSM specific calls.
|
|
||||||
*
|
|
||||||
* @package PTA
|
|
||||||
* @subpackage ORM
|
|
||||||
* @category Overrides
|
|
||||||
* @author Deon George
|
|
||||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
|
||||||
* @license http://phptsmadmin.sf.net/license.html
|
|
||||||
*/
|
|
||||||
class ORM extends Kohana_ORM {
|
|
||||||
/**
|
|
||||||
* Override Kohana's FIND to remove the LIMIT
|
|
||||||
*/
|
|
||||||
public function find($id = NULL) {
|
|
||||||
// Since TSM doesnt support LIMIT, we'll use find_all() but return the first record
|
|
||||||
foreach ($this->find_all() as $object) {
|
|
||||||
// In TSM Primary Keys are in upper case
|
|
||||||
if (is_null($id) OR $object->{$object->_primary_key} == strtoupper($id))
|
|
||||||
$this->_load_values($object->_object);
|
|
||||||
|
|
||||||
// If we have found our item return
|
|
||||||
if ($this->_loaded)
|
|
||||||
return $object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We need to call our own _load_values() to support find() and TSM::result()
|
|
||||||
*
|
|
||||||
* (Since _load_values is protected, we need to make it public here,
|
|
||||||
* so that it can be called in TSM::result().)
|
|
||||||
*
|
|
||||||
* @see TSM::result
|
|
||||||
* @see ORM::find
|
|
||||||
*/
|
|
||||||
public function _load_values(array $values) {
|
|
||||||
return parent::_load_values($values);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
@ -15,6 +15,8 @@ abstract class ORMTSM extends ORM {
|
|||||||
protected $_disable_wild_select = TRUE;
|
protected $_disable_wild_select = TRUE;
|
||||||
// Suppress ORMs inclusion of <table_name>. to column joins
|
// Suppress ORMs inclusion of <table_name>. to column joins
|
||||||
protected $_disable_join_table_name = TRUE;
|
protected $_disable_join_table_name = TRUE;
|
||||||
|
// Suppress ORMs use of limit
|
||||||
|
protected $_disable_limit = TRUE;
|
||||||
|
|
||||||
// Enable the formating of columns
|
// Enable the formating of columns
|
||||||
protected $_object_formated = array();
|
protected $_object_formated = array();
|
||||||
@ -48,7 +50,7 @@ abstract class ORMTSM extends ORM {
|
|||||||
$value = $this->__get($column);
|
$value = $this->__get($column);
|
||||||
|
|
||||||
// If some of our fields need to be formated for display purposes.
|
// If some of our fields need to be formated for display purposes.
|
||||||
if ($this->_loaded AND ! $this->_formated AND $this->_formats)
|
if ($value AND ! $this->_formated AND $this->_formats)
|
||||||
$this->_format();
|
$this->_format();
|
||||||
|
|
||||||
if (isset($this->_object_formated[$column]))
|
if (isset($this->_object_formated[$column]))
|
||||||
|
@ -16,6 +16,7 @@ return array(
|
|||||||
'stanza' => '',
|
'stanza' => '',
|
||||||
'client_errorlogname' => '/tmp/pta-tsm-errorlog.log',
|
'client_errorlogname' => '/tmp/pta-tsm-errorlog.log',
|
||||||
'date_format' => 'd-m-Y',
|
'date_format' => 'd-m-Y',
|
||||||
|
'tsmpooltypes' => array('PRIMARY','ACTIVEDATA','COPY'),
|
||||||
'email_admin_only'=> array(
|
'email_admin_only'=> array(
|
||||||
'method'=>array('wurley@users.sf.net'=>'Deon George'),
|
'method'=>array('wurley@users.sf.net'=>'Deon George'),
|
||||||
),
|
),
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
<td style="width: 50%; vertical-align: top;">
|
<td style="width: 50%; vertical-align: top;">
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="head" colspan="2">Last Backup Performance Information</td>
|
<td class="head" colspan="2">Last Session Performance Information</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="spacer"> </td>
|
<td class="spacer"> </td>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<?php if ($node->storagepools('BACKUP')) { ?>
|
|
||||||
<td style="width: 50%; vertical-align: top;">
|
<td style="width: 50%; vertical-align: top;">
|
||||||
<table class="box-full">
|
<table class="box-full">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="head" colspan="2">Backup Information</td>
|
<td class="head" colspan="2">Backup Information</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php if ($node->storagepools('Bkup')) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="spacer"> </td>
|
<td class="spacer"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -14,65 +14,65 @@
|
|||||||
<td>Last Date</td>
|
<td>Last Date</td>
|
||||||
<td style="text-align: right;">Utilisation</td>
|
<td style="text-align: right;">Utilisation</td>
|
||||||
<?php foreach (Kohana::config('config.tsmpooltypes') as $type)
|
<?php foreach (Kohana::config('config.tsmpooltypes') as $type)
|
||||||
if (count($pools = $node->getStoragePools('BACKUP',$type)))
|
if (count($pools = $node->getStoragePools('Bkup',$type)))
|
||||||
foreach ($pools as $pool_name) { ?>
|
foreach ($pools as $pool_name) { ?>
|
||||||
<td style="text-align: right;"><?php echo $pool_name; ?> <span style="vertical-align: super; font-size: 60%;"><?echo $type; ?></span></td>
|
<td style="text-align: right;"><?php echo $pool_name; ?> <span style="vertical-align: super; font-size: 60%;"><?echo $type; ?></span></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php foreach ($node->FILESPACE->find_all() as $fso) { ?>
|
<?php $i=0;foreach ($node->FILESPACE->find_all() as $fso) { ?>
|
||||||
<tr>
|
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
|
||||||
<td class="head"><?php echo $fso->display('FILESPACE_NAME'); ?></td>
|
<td class="head"><?php echo $fso->display('FILESPACE_NAME'); ?></td>
|
||||||
<td class="head"><?php echo $fso->display('BACKUP_END'); ?></td>
|
<td class="head"><?php echo $fso->display('BACKUP_END'); ?></td>
|
||||||
<td class="head" style="text-align: right;"><?php echo number_format($fso->utilsation(),2); ?></td>
|
<td class="head" style="text-align: right;"><?php echo number_format($fso->utilsation(),2); ?></td>
|
||||||
<?php foreach (Kohana::config('config.tsmpooltypes') as $type)
|
<?php foreach (Kohana::config('config.tsmpooltypes') as $type)
|
||||||
if (count($pools = $node->getStoragePools('BACKUP',$type)))
|
if (count($pools = $node->getStoragePools('Bkup',$type)))
|
||||||
foreach ($pools as $pool_name) { ?>
|
foreach ($pools as $pool_name) { ?>
|
||||||
<td class="head" style="text-align: right;"><?php echo number_format($fso->pool_logical_util($pool_name),2); ?> (<?php echo $fso->pool_numvols($pool_name); ?>)</td>
|
<td class="head" style="text-align: right; vertical-align: top;"><?php echo number_format($fso->pool_logical_util($pool_name),2); ?> (<?php echo $fso->pool_numvols($pool_name); ?>)</td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<?php } else { ?>
|
||||||
|
<tr><td>There is NO Backup Data for this Node.</td></tr>
|
||||||
|
<?php } ?>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
<?php } ?>
|
|
||||||
<td style="width: 50%; vertical-align: top;">
|
<td style="width: 50%; vertical-align: top;">
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<?php if ($node->storagepools('ARCHIVE')) { ?>
|
|
||||||
<td style="width: 50%; vertical-align: top;">
|
<td style="width: 50%; vertical-align: top;">
|
||||||
<table class="box-full">
|
<table class="box-full">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="head" colspan="2">Backup Information</td>
|
<td class="head" colspan="2">Archive Information</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php if ($node->storagepools('Arch')) { ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="spacer"> </td>
|
<td class="spacer"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>File Space</td>
|
<td>File Space</td>
|
||||||
<td>Utilisation</td>
|
|
||||||
<td>Last Date</td>
|
|
||||||
<?php foreach (Kohana::config('config.tsmpooltypes') as $type)
|
<?php foreach (Kohana::config('config.tsmpooltypes') as $type)
|
||||||
if (count($pools = $node->getStoragePools('ARCHIVE',$type)))
|
if (count($pools = $node->getStoragePools('Arch',$type)))
|
||||||
foreach ($pools as $pool_name) { ?>
|
foreach ($pools as $pool_name) { ?>
|
||||||
<td style="text-align: right;"><?php echo $pool_name; ?> <span style="vertical-align: super; font-size: 60%;"><?echo $type; ?></span></td>
|
<td style="text-align: right;"><?php echo $pool_name; ?> <span style="vertical-align: super; font-size: 60%;"><?echo $type; ?></span></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php foreach ($node->FILESPACE->find_all() as $fso) { ?>
|
<?php $i=0;foreach ($node->FILESPACE->find_all() as $fso) { ?>
|
||||||
<tr>
|
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
|
||||||
<td class="head"><?php echo $fso->display('FILESPACE_NAME'); ?></td>
|
<td class="head"><?php echo $fso->display('FILESPACE_NAME'); ?></td>
|
||||||
<td class="head"><?php echo number_format($fso->utilsation(),2); ?></td>
|
|
||||||
<td class="head"><?php echo $fso->display('BACKUP_END'); ?></td>
|
|
||||||
<?php foreach (Kohana::config('config.tsmpooltypes') as $type)
|
<?php foreach (Kohana::config('config.tsmpooltypes') as $type)
|
||||||
if (count($pools = $node->getStoragePools('ARCHIVE',$type)))
|
if (count($pools = $node->getStoragePools('Arch',$type)))
|
||||||
foreach ($pools as $pool_name) { ?>
|
foreach ($pools as $pool_name) { ?>
|
||||||
<td class="head" style="text-align: right;"><?php echo number_format($fso->pool_logical_util($pool_name),2); ?> (<?php echo $fso->pool_numvols($pool_name); ?>)</td>
|
<td class="head" style="text-align: right; vertical-align: top;"><?php echo number_format($fso->pool_logical_util($pool_name),2); ?> (<?php echo $fso->pool_numvols($pool_name); ?>)</td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<?php } else { ?>
|
||||||
|
<tr><td>There is NO Archive Data for this Node.</td></tr>
|
||||||
|
<?php } ?>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
<?php } ?>
|
|
||||||
<td style="width: 50%; vertical-align: top;">
|
<td style="width: 50%; vertical-align: top;">
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
|
Reference in New Issue
Block a user