2011-04-07 05:03:05 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides information on TSM Nodes.
|
|
|
|
*
|
|
|
|
* @package PTA
|
|
|
|
* @subpackage Nodes
|
|
|
|
* @category Controllers
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2010 phpTSMadmin Development Team
|
|
|
|
* @license http://phptsmadmin.sf.net/license.html
|
|
|
|
*/
|
2012-11-30 02:03:26 +00:00
|
|
|
class Controller_Node extends Controller_TemplateDefault_View {
|
|
|
|
protected $index_title = 'TSM Nodes';
|
|
|
|
protected $detail_title = 'Information on Node';
|
|
|
|
protected $orm = 'NODE';
|
2012-12-11 11:56:33 +00:00
|
|
|
|
2012-12-12 10:39:00 +00:00
|
|
|
/**
|
|
|
|
* Gather the BA Client Session data for graphing
|
|
|
|
*/
|
|
|
|
public function action_ajaxjson_basessions() {
|
2012-12-11 11:56:33 +00:00
|
|
|
$id = $this->request->param('id');
|
|
|
|
$c = (isset($_REQUEST['c'])) ? $_REQUEST['c'] : null;
|
|
|
|
$s = (isset($_REQUEST['s'])) ? $_REQUEST['s'] : null;
|
|
|
|
$t = (isset($_REQUEST['t'])) ? $_REQUEST['t'] : null;
|
|
|
|
|
|
|
|
$no = ORM::factory('NODE',$id);
|
|
|
|
|
|
|
|
if (! $id OR ! $no->loaded() OR ! $t OR ! $c)
|
|
|
|
return '';
|
|
|
|
|
2012-12-12 10:39:00 +00:00
|
|
|
$google = GoogleChart::factory($c)
|
|
|
|
->logy(TRUE)
|
|
|
|
->title(sprintf('%s Activity',$t).($s ? sprintf(' for Schedule %s',$s) : ' outside of TSM schedules'));
|
|
|
|
|
|
|
|
foreach ($no->act_bybtype($t) as $aso) {
|
|
|
|
if ($aso->SCHEDULE_NAME != $s)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
$result = array();
|
|
|
|
|
|
|
|
foreach ($aso->actlog() as $alo) {
|
|
|
|
$result = array_merge($result,$alo->msgtrim());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! $result)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
$google->pdata($aso->display('START_TIME'),array(
|
|
|
|
'yr'=>array(
|
|
|
|
'OBJECT_TOTAL'=>$result['OBJECT_TOTAL'],
|
|
|
|
'OBJECT_BACKUP'=>$result['OBJECT_BACKUP'],
|
|
|
|
'OBJECT_DELETED'=>$result['OBJECT_DELETED'],
|
|
|
|
'OBJECT_UDPATE'=>$result['OBJECT_UDPATE'],
|
|
|
|
'OBJECT_FAILED'=>$result['OBJECT_FAILED'],
|
|
|
|
'OBJECT_REBOUND'=>$result['OBJECT_REBOUND'],
|
|
|
|
'OBJECT_EXPIRED'=>$result['OBJECT_EXPIRED'],
|
|
|
|
'OJBECT_DEDUPED'=>$result['OJBECT_DEDUPED'],
|
|
|
|
),
|
|
|
|
'yl'=>array(
|
|
|
|
'BYTES_INSPECT'=>$result['BYTES_INSPECT'],
|
|
|
|
'BYTES_PROCESS'=>$result['BYTES_PROCESS'],
|
|
|
|
'BYTES_TRANSFER'=>$result['BYTES_TRANSFER'],
|
|
|
|
'BYTES_DEDUPE_BEFORE'=>$result['BYTES_DEDUPE_BEFORE'],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->auto_render = FALSE;
|
|
|
|
$this->response->headers('Content-Type','application/json');
|
|
|
|
$this->response->body($google->json());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gather the TSM Server Schedule Activity for Graphing
|
|
|
|
*/
|
|
|
|
public function action_ajaxjson_schedules() {
|
|
|
|
$id = $this->request->param('id');
|
|
|
|
$c = (isset($_REQUEST['c'])) ? $_REQUEST['c'] : null;
|
|
|
|
$s = (isset($_REQUEST['s'])) ? $_REQUEST['s'] : null;
|
|
|
|
$t = (isset($_REQUEST['t'])) ? $_REQUEST['t'] : null;
|
|
|
|
|
|
|
|
$no = ORM::factory('NODE',$id);
|
|
|
|
|
|
|
|
if (! $id OR ! $no->loaded() OR ! $t OR ! $c)
|
|
|
|
return '';
|
2012-12-11 11:56:33 +00:00
|
|
|
|
|
|
|
$google = GoogleChart::factory($c)
|
|
|
|
->logy(TRUE)
|
|
|
|
->title(sprintf('%s Activity',$t).($s ? sprintf(' for Schedule %s',$s) : ' outside of TSM schedules'));
|
|
|
|
|
|
|
|
foreach ($no->act_bybtype($t) as $aso) {
|
|
|
|
if ($aso->SCHEDULE_NAME != $s)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
$google->pdata($aso->display('START_TIME'),array(
|
|
|
|
'yr'=>array(
|
|
|
|
'BYTES'=>$aso->BYTES,
|
|
|
|
),
|
|
|
|
'yl'=>array(
|
|
|
|
'AFFECTED'=>$aso->AFFECTED,
|
|
|
|
'EXAMINED'=>$aso->EXAMINED,
|
|
|
|
'FAILED'=>$aso->FAILED,
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->auto_render = FALSE;
|
|
|
|
$this->response->headers('Content-Type','application/json');
|
|
|
|
$this->response->body($google->json());
|
|
|
|
}
|
2012-12-12 04:00:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return details of a specific node SESSION in the ACTIVITY LOG
|
|
|
|
* @param $id NODE,SESSION_ID,SESSION_START_DATE
|
|
|
|
*/
|
|
|
|
public function action_session() {
|
|
|
|
$id = $this->request->param('id');
|
|
|
|
|
|
|
|
if (substr_count($id,',') != 2) {
|
|
|
|
SystemMessage::add(array(
|
|
|
|
'title'=>_('Invalid ID'),
|
|
|
|
'body'=>sprintf(_('The session ID %s is invalid'),$id),
|
|
|
|
'type'=>'error',
|
|
|
|
));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
list($nid,$sid,$start) = explode(',',$id,3);
|
|
|
|
|
|
|
|
$no = ORM::factory('NODE',$nid);
|
|
|
|
if (! $no->loaded()) {
|
|
|
|
SystemMessage::add(array(
|
|
|
|
'title'=>_('Invalid Node'),
|
|
|
|
'body'=>sprintf(_('The Node ID %s is invalid'),$nid),
|
|
|
|
'type'=>'error',
|
|
|
|
));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Block::add(array(
|
|
|
|
'title'=>sprintf(_('Session %s Detail for Node %s'),$sid,$no->display('NODE_NAME')),
|
|
|
|
'body'=>View::factory(sprintf('%s/clientsession',strtolower($this->request->controller())))->set('o',$no->actlog_session($sid,$start)),
|
|
|
|
));
|
|
|
|
}
|
2011-04-07 05:03:05 +00:00
|
|
|
}
|
|
|
|
?>
|