91 lines
2.6 KiB
PHP
91 lines
2.6 KiB
PHP
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* @package PTA
|
||
|
* @subpackage Nodes
|
||
|
* @category Models
|
||
|
* @author Deon George
|
||
|
* @copyright (c) 2010 phpTSMadmin Development Team
|
||
|
* @license http://phptsmadmin.sf.net/license.html
|
||
|
*/
|
||
|
class Model_NODE extends ORMTSM {
|
||
|
protected $_table_name = 'NODES';
|
||
|
protected $_primary_key = 'NODE_NAME';
|
||
|
|
||
|
protected $_formats = array(
|
||
|
'REG_TIME'=>array('ORMTSM::date'=>array('d-M-Y')),
|
||
|
'PWSET_TIME'=>array('ORMTSM::date'=>array('d-M-Y')),
|
||
|
'LASTACC_TIME'=>array('ORMTSM::date'=>array('d-M-Y')),
|
||
|
'LASTSESS_SENT'=>array('number_format'=>array(0)),
|
||
|
'LASTSESS_RECVD'=>array('number_format'=>array(0)),
|
||
|
'LASTSESS_DURATION'=>array('number_format'=>array(2)),
|
||
|
'LASTSESS_IDLEWAIT'=>array('number_format'=>array(2)),
|
||
|
'LASTSESS_COMMWAIT'=>array('number_format'=>array(2)),
|
||
|
'LASTSESS_MEDIAWAIT'=>array('number_format'=>array(2)),
|
||
|
);
|
||
|
|
||
|
protected $_sorting = array(
|
||
|
'NODE_NAME'=>'ASC',
|
||
|
);
|
||
|
|
||
|
public function tsmclientversion() {
|
||
|
return sprintf('%s.%s.%s.%s',$this->CLIENT_VERSION,$this->CLIENT_RELEASE,$this->CLIENT_LEVEL,$this->CLIENT_SUBLEVEL);
|
||
|
}
|
||
|
|
||
|
// @todo This needs to return the global configuration.
|
||
|
public function passexp() {
|
||
|
if ($this->PASSEXP)
|
||
|
return 'TBA';
|
||
|
else
|
||
|
return _('No Set');
|
||
|
}
|
||
|
|
||
|
public function lasttransferpercent() {
|
||
|
return number_format(100-($this->LASTSESS_IDLEWAIT+$this->LASTSESS_COMMWAIT+$this->LASTSESS_MEDIAWAIT),2);
|
||
|
}
|
||
|
|
||
|
public function lasttransfertime() {
|
||
|
return number_format($this->LASTSESS_DURATION*($this->lasttransferpercent()/100),2);
|
||
|
}
|
||
|
|
||
|
public function lastsendperformance() {
|
||
|
if ($this->lasttransfertime())
|
||
|
return number_format($this->LASTSESS_SENT/$this->lasttransfertime()/1024/1024,2);
|
||
|
else
|
||
|
return _('N/A');
|
||
|
}
|
||
|
|
||
|
public function lastreceiveperformance() {
|
||
|
if ($this->lasttransfertime())
|
||
|
return number_format($this->LASTSESS_RECVD/$this->lasttransfertime()/1024/1024,2);
|
||
|
else
|
||
|
return _('N/A');
|
||
|
}
|
||
|
|
||
|
public function lastsendaggperformance() {
|
||
|
return number_format($this->LASTSESS_SENT/$this->LASTSESS_DURATION/1024/1024,2);
|
||
|
}
|
||
|
|
||
|
public function lastreceiveaggperformance() {
|
||
|
return number_format($this->LASTSESS_RECVD/$this->LASTSESS_DURATION/1024/1024,2);
|
||
|
}
|
||
|
|
||
|
// @todo This should return the system setting (cloptset), if the node setting is not configured.
|
||
|
public function txngroupmax() {
|
||
|
return $this->display('TXNGROUPMAX');
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Get all the nodes by OS
|
||
|
*/
|
||
|
public function byos() {
|
||
|
$a = $this->select('count(*) AS node_name,platform_name')
|
||
|
->group_by('platform_name')
|
||
|
->order_by('platform_name');
|
||
|
|
||
|
return $a->find_all();
|
||
|
}
|
||
|
}
|
||
|
?>
|