Added Node Sessions
This commit is contained in:
parent
c9a1d39912
commit
0122cd8c02
32
application/classes/Model/ACTSUM.php
Normal file
32
application/classes/Model/ACTSUM.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @package PTA
|
||||||
|
* @subpackage Activity Summary
|
||||||
|
* @category Models
|
||||||
|
* @author Deon George
|
||||||
|
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||||
|
* @license http://phptsmadmin.sf.net/license.html
|
||||||
|
*/
|
||||||
|
class Model_ACTSUM extends ORM_TSM {
|
||||||
|
protected $_table_name = 'ACTIVITY_SUMMARY';
|
||||||
|
protected $_primary_key = 'START_TIME';
|
||||||
|
protected $_sorting = array(
|
||||||
|
'START_TIME'=>'ASC',
|
||||||
|
);
|
||||||
|
|
||||||
|
protected $_display_filters = array(
|
||||||
|
'START_TIME'=>array(
|
||||||
|
array('ORM_TSM::date',array(':value','d-M H:i')),
|
||||||
|
),
|
||||||
|
'END_TIME'=>array(
|
||||||
|
array('ORM_TSM::date',array(':value','d-M H:i')),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
public function bytes() {
|
||||||
|
return (real)number_format($this->BYTES/1024/1024,0,'','');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
@ -115,6 +115,32 @@ class Model_NODE extends ORM_TSM {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all the ACTIVITY SUMMARY for this NODE
|
||||||
|
*/
|
||||||
|
private function _actsum() {
|
||||||
|
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||||
|
|
||||||
|
$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();
|
||||||
|
|
||||||
|
// 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('ACTSUM')->order_by('SCHEDULE_NAME')->find_all() as $o)
|
||||||
|
if ($o->ENTITY == $this->NODE_NAME)
|
||||||
|
array_push($result,$o);
|
||||||
|
|
||||||
|
// @todo Cache time should be configurble
|
||||||
|
Cache::instance($c)->set($k,$result,300);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the FILESPACES for this NODE
|
* Get all the FILESPACES for this NODE
|
||||||
*/
|
*/
|
||||||
@ -287,6 +313,31 @@ class Model_NODE extends ORM_TSM {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ACTIVITY of this NODE
|
||||||
|
* @param $type is Bkup/Arch/SpMg
|
||||||
|
*/
|
||||||
|
public function act_bybtype($type) {
|
||||||
|
Log::instance()->add(LOG::DEBUG,'ENTER :method',array(':method'=>__METHOD__));
|
||||||
|
|
||||||
|
$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->_actsum() as $aso)
|
||||||
|
if ($aso->ACTIVITY == $this->datatypemap($type))
|
||||||
|
array_push($result,$aso);
|
||||||
|
|
||||||
|
// @todo Cache time should be configurble
|
||||||
|
Cache::instance($c)->set($k,$result,300);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log::instance()->add(LOG::DEBUG,'EXIT :method',array(':method'=>__METHOD__));
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the BACKUP TYPES used by this NODE
|
* Return the BACKUP TYPES used by this NODE
|
||||||
* ie: Bkup/Arch/SpMg
|
* ie: Bkup/Arch/SpMg
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/cloptset')->set('o',$o); ?></td>
|
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/cloptset')->set('o',$o); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<?php echo View::factory('node/sessions')->set('o',$o); ?>
|
||||||
<?php echo View::factory('node/filesystems')->set('o',$o); ?>
|
<?php echo View::factory('node/filesystems')->set('o',$o); ?>
|
||||||
<?php echo View::factory('node/volumes')->set('o',$o); ?>
|
<?php echo View::factory('node/volumes')->set('o',$o); ?>
|
||||||
<?php echo View::factory('node/schedule')->set('o',$o); ?>
|
<?php echo View::factory('node/schedule')->set('o',$o); ?>
|
||||||
|
55
application/views/node/sessions.php
Normal file
55
application/views/node/sessions.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<!-- $o = ORM::factory('NODE') -->
|
||||||
|
<table width="100%">
|
||||||
|
<?php foreach ($o->btypes() as $btype) { ?>
|
||||||
|
<tr>
|
||||||
|
<td style="width: 100%; vertical-align: top;">
|
||||||
|
<table class="box-full">
|
||||||
|
<tr>
|
||||||
|
<td class="head" colspan="2"><?php echo $btype.' '._('Sessions'); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php if ($o->act_bybtype($btype)) { ?>
|
||||||
|
<tr>
|
||||||
|
<td class="spacer"> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Start</td>
|
||||||
|
<td>End</td>
|
||||||
|
<td>Comm</td>
|
||||||
|
<td>Schedule</td>
|
||||||
|
<td class="right">Session</td>
|
||||||
|
<td class="right">Examined</td>
|
||||||
|
<td class="right">Backed Up</td>
|
||||||
|
<td class="right">Failed</td>
|
||||||
|
<td class="right">MB</td>
|
||||||
|
<td class="right">Idle</td>
|
||||||
|
<td class="right">Media Wait</td>
|
||||||
|
<td class="right">Comm Wait</td>
|
||||||
|
<td class="right">Process</td>
|
||||||
|
<td class="right">Success</td>
|
||||||
|
</tr>
|
||||||
|
<?php $i=0; foreach ($o->act_bybtype($btype) as $ao) { ?>
|
||||||
|
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
|
||||||
|
<td class="data"><?php echo $ao->display('START_TIME'); ?></td>
|
||||||
|
<td class="data"><?php echo $ao->display('END_TIME'); ?></td>
|
||||||
|
<td class="data"><?php echo $ao->display('COMMMETH'); ?></td>
|
||||||
|
<td class="data"><?php echo $ao->display('SCHEDULE_NAME'); ?></td>
|
||||||
|
<td class="data-right"><?php echo $ao->display('NUMBER'); ?></td>
|
||||||
|
<td class="data-right"><?php echo $ao->display('EXAMINED'); ?></td>
|
||||||
|
<td class="data-right"><?php echo $ao->display('AFFECTED'); ?></td>
|
||||||
|
<td class="data-right"><?php echo $ao->display('FAILED'); ?></td>
|
||||||
|
<td class="data-right"><?php echo $ao->bytes(); ?></td>
|
||||||
|
<td class="data-right"><?php echo $ao->display('IDLE'); ?></td>
|
||||||
|
<td class="data-right"><?php echo $ao->display('MEDIAW'); ?></td>
|
||||||
|
<td class="data-right"><?php echo $ao->display('COMM_WAIT'); ?></td>
|
||||||
|
<td class="data-right"><?php echo $ao->display('PROCESSES'); ?></td>
|
||||||
|
<td class="data-right"><?php echo $ao->display('SUCCESSFUL'); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
<?php } else { ?>
|
||||||
|
<tr><td><?php echo _('There is NO activity for this Node.'); ?></td></tr>
|
||||||
|
<?php } ?>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</table>
|
Reference in New Issue
Block a user