Added Client Session graphing
This commit is contained in:
parent
12a2a53ef7
commit
d84d7de251
@ -15,7 +15,10 @@ class Controller_Node extends Controller_TemplateDefault_View {
|
||||
protected $detail_title = 'Information on Node';
|
||||
protected $orm = 'NODE';
|
||||
|
||||
public function action_ajax_jsonbackup() {
|
||||
/**
|
||||
* Gather the BA Client Session data for graphing
|
||||
*/
|
||||
public function action_ajaxjson_basessions() {
|
||||
$id = $this->request->param('id');
|
||||
$c = (isset($_REQUEST['c'])) ? $_REQUEST['c'] : null;
|
||||
$s = (isset($_REQUEST['s'])) ? $_REQUEST['s'] : null;
|
||||
@ -26,7 +29,61 @@ class Controller_Node extends Controller_TemplateDefault_View {
|
||||
if (! $id OR ! $no->loaded() OR ! $t OR ! $c)
|
||||
return '';
|
||||
|
||||
$result = array();
|
||||
$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 '';
|
||||
|
||||
$google = GoogleChart::factory($c)
|
||||
->logy(TRUE)
|
||||
|
@ -22,10 +22,39 @@ class Model_ACTLOG extends ORM_TSM {
|
||||
),
|
||||
);
|
||||
|
||||
private $_msgno_ba_objects = array(4952,4953,4954,4958,4960,4957,4970,4959,4982);
|
||||
private $_msgno_ba_bytes = array(4977,4975,4984,4198,4961);
|
||||
private $_msgno_ba_transfer = array(4963,4966,4967,4964);
|
||||
private $_msgno_ba_reduction = array(4968,4981,4976);
|
||||
private $_msgno_ba_objects = array(
|
||||
4952=>array('msg'=>'ANE4952I Total number of objects inspected:\s+([0-9,]+).*','id'=>'OBJECT_TOTAL'),
|
||||
4953=>array('msg'=>'','id'=>''),
|
||||
4954=>array('msg'=>'ANE4954I Total number of objects backed up:\s+([0-9,]+).*','id'=>'OBJECT_BACKUP'),
|
||||
4957=>array('msg'=>'ANE4957I Total number of objects deleted:\s+([0-9,]+).*','id'=>'OBJECT_DELETED'),
|
||||
4958=>array('msg'=>'ANE4958I Total number of objects updated:\s+([0-9,]+).*','id'=>'OBJECT_UDPATE'),
|
||||
4959=>array('msg'=>'ANE4959I Total number of objects failed:\s+([0-9,]+).*','id'=>'OBJECT_FAILED'),
|
||||
4960=>array('msg'=>'ANE4960I Total number of objects rebound:\s+([0-9,]+).*','id'=>'OBJECT_REBOUND'),
|
||||
4970=>array('msg'=>'ANE4970I Total number of objects expired:\s+([0-9,]+).*','id'=>'OBJECT_EXPIRED'),
|
||||
4982=>array('msg'=>'ANE4982I Total objects deduplicated:\s+([0-9,]+).*','id'=>'OJBECT_DEDUPED'),
|
||||
);
|
||||
private $_msgno_ba_bytes = array(
|
||||
4961=>array('msg'=>'ANE4961I Total number of bytes transferred:\s+([0-9,\.]+) ([KMG]B).*','id'=>'BYTES_TRANSFER'),
|
||||
4977=>array('msg'=>'ANE4977I Total number of bytes inspected:\s+([0-9,\.]+) ([KMG]B).*','id'=>'BYTES_INSPECT'),
|
||||
4975=>array('msg'=>'ANE4975I Total number of bytes processed:\s+([0-9,\.]+) ([KMG]B).*','id'=>'BYTES_PROCESS'),
|
||||
4984=>array('msg'=>'ANE4984I Total bytes before deduplication:\s+([0-9,\.]+) ([KMG]B).*','id'=>'BYTES_DEDUPE_BEFORE'),
|
||||
4198=>array('msg'=>'','id'=>''),
|
||||
);
|
||||
private $_msgno_ba_transfer = array(
|
||||
4963=>array('msg'=>'ANE4963I Data transfer time:\s+([0-9,\.]+).*','id'=>'TRANSFER_SEC'),
|
||||
4966=>array('msg'=>'ANE4966I Network data transfer rate:\s+([0-9,\.]+).*','id'=>'TRANSFER_RATE'),
|
||||
4967=>array('msg'=>'ANE4967I Aggregate data transfer rate:\s+([0-9,\.]+).*','id'=>'TRANSFER_AGGR'),
|
||||
4964=>array('msg'=>'ANE4964I Elapsed processing time:\s+([0-9:]+).*','id'=>'PROCESS_TIME'),
|
||||
);
|
||||
private $_msgno_ba_reduction = array(
|
||||
4968=>array('msg'=>'ANE4968I Objects compressed by:\s+([0-9,\.]+).*','id'=>'COMPRESS'),
|
||||
4981=>array('msg'=>'ANE4981I Deduplication reduction:\s+([0-9,\.]+).*','id'=>'DEDUPE'),
|
||||
4976=>array('msg'=>'ANE4976I Total data reduction ratio:\s+([0-9,\.]+).*','id'=>'REDUCTION'),
|
||||
);
|
||||
|
||||
private function _bamsgs() {
|
||||
return $this->_msgno_ba_objects+$this->_msgno_ba_bytes+$this->_msgno_ba_transfer+$this->_msgno_ba_reduction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the timestamp of the record in the ACTLOG
|
||||
@ -38,7 +67,43 @@ class Model_ACTLOG extends ORM_TSM {
|
||||
* Where class to exclude NODE backup messages
|
||||
*/
|
||||
public function ExcludeBA() {
|
||||
return $this->where('MSGNO','NOT IN',array_merge($this->_msgno_ba_objects,$this->_msgno_ba_bytes,$this->_msgno_ba_transfer,$this->_msgno_ba_reduction));
|
||||
return $this->where('MSGNO','NOT IN',array_keys($this->_bamsgs()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract data from our BA Client messages
|
||||
*/
|
||||
public function msgtrim() {
|
||||
$x = $this->_bamsgs();
|
||||
|
||||
if (! array_key_exists($this->MSGNO,$x))
|
||||
return array();
|
||||
|
||||
// @todo Shouldnt need this
|
||||
if (empty($x[$this->MSGNO]['id']))
|
||||
throw new Kohana_Exception('Message has no ID :id [:msg]',array(':id'=>$this->MSGNO,':msg'=>$this->MESSAGE));
|
||||
|
||||
$y = preg_replace('/'.$x[$this->MSGNO]['msg'].'/',"$1$2",$this->MESSAGE);
|
||||
|
||||
$m = array();
|
||||
// Do we have units we need to convert?
|
||||
if (preg_match('/^(.*)([KMG]B)$/',$y,$m)) {
|
||||
// Our number is in m[1]
|
||||
$y = $m[1];
|
||||
|
||||
// Our unit is in m[2], convert to bytes
|
||||
switch ($m[2]) {
|
||||
case 'GB': $y *= 1024;
|
||||
case 'MB': $y *= 1024;
|
||||
case 'KB': $y *= 1024;
|
||||
}
|
||||
}
|
||||
|
||||
// Safety check to make sure we extracted what we wanted.
|
||||
if ($y == $this->MESSAGE)
|
||||
throw new Kohana_Exception('Unable to extra data from message :id [:msg]',array(':id'=>$this->MSGNO,':msg'=>$this->MESSAGE));
|
||||
|
||||
return array($x[$this->MSGNO]['id']=>str_replace(',','',$y));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,6 +16,10 @@ class Model_ACTSUM extends ORM_TSM {
|
||||
'START_TIME'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_has_one = array(
|
||||
'NODE'=>array('foreign_key'=>'NODE_NAME','far_key'=>'ENTITY'),
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
'START_TIME'=>array(
|
||||
array('ORM_TSM::date',array(':value','d-M H:i')),
|
||||
@ -32,6 +36,16 @@ class Model_ACTSUM extends ORM_TSM {
|
||||
return ORM_TSM::date(ORM::factory('ACTLOG')->FirstRec(),'U') <= $this->start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ACTIVITY LOG data for this SESSION
|
||||
*/
|
||||
public function actlog() {
|
||||
if (! isset($this->ENTITY))
|
||||
throw new Kohana_Exception('Activity Summary has no NODENAME data');
|
||||
|
||||
return $this->NODE->actlog_session($this->NUMBER,$this->start());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return this ACTIVITY SUMMARY in GB
|
||||
*/
|
||||
|
@ -512,17 +512,31 @@ class Model_NODE extends ORM_TSM {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Graph of the Schedule Backup Activity
|
||||
* Return a Graph of the BA Client Sessions
|
||||
* @param $type is Bkup/Arch/SpMg
|
||||
* @see [node/json_backup]
|
||||
* @see [node/ajaxjson_basessions]
|
||||
*/
|
||||
public function graph_backup($type='Bkup',$schedule='') {
|
||||
public function graph_basessions($type='Bkup',$schedule='') {
|
||||
$chart = 'ComboChart';
|
||||
|
||||
$google = GoogleChart::factory($chart)
|
||||
->title(sprintf('%s Activity',$type))
|
||||
->div(sprintf('%s_%s',$type,$schedule))
|
||||
->dataurl(URL::site(sprintf('node/ajax_jsonbackup/%s?c=%s&s=%s&t=%s',$this->NODE_NAME,$chart,$schedule,$type)));
|
||||
->div(sprintf('bas_%s_%s',$type,$schedule))
|
||||
->dataurl(URL::site(sprintf('node/ajaxjson_basessions/%s?c=%s&s=%s&t=%s',$this->NODE_NAME,$chart,$schedule,$type)));
|
||||
|
||||
return (string)$google;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Graph of the Schedule Backup Activity
|
||||
* @param $type is Bkup/Arch/SpMg
|
||||
* @see [node/ajaxjson_schedules]
|
||||
*/
|
||||
public function graph_schedules($type='Bkup',$schedule='') {
|
||||
$chart = 'ComboChart';
|
||||
|
||||
$google = GoogleChart::factory($chart)
|
||||
->div(sprintf('sch_%s_%s',$type,$schedule))
|
||||
->dataurl(URL::site(sprintf('node/ajaxjson_schedules/%s?c=%s&s=%s&t=%s',$this->NODE_NAME,$chart,$schedule,$type)));
|
||||
|
||||
return (string)$google;
|
||||
}
|
||||
|
@ -4,15 +4,17 @@
|
||||
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/session')->set('o',$o); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 50%; vertical-align: top;" colspan="2"><?php echo View::factory('node/graph_backup')->set('o',$o); ?></td>
|
||||
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('domain/policy')->set('o',$o->DOMAIN); ?></td>
|
||||
<td style="width: 50%; vertical-align: top;" rowspan="2"><?php echo View::factory('node/cloptset')->set('o',$o); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/settings')->set('o',$o); ?></td>
|
||||
<td style="width: 50%; vertical-align: top;"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('domain/policy')->set('o',$o->DOMAIN); ?></td>
|
||||
<td style="width: 50%; vertical-align: top;"><?php echo View::factory('node/cloptset')->set('o',$o); ?></td>
|
||||
<td style="width: 50%; vertical-align: top;" colspan="2"><?php echo View::factory('node/graph_schedules')->set('o',$o); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 50%; vertical-align: top;" colspan="2"><?php echo View::factory('node/graph_sessions')->set('o',$o); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo View::factory('node/sessions')->set('o',$o); ?>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<?php if ($o->act_bybtype($btype)) { ?>
|
||||
<?php foreach ($o->act_schedules($btype) as $schedule) { ?>
|
||||
<tr>
|
||||
<td><?php echo $o->graph_backup($btype,$schedule); ?></td>
|
||||
<td><?php echo $o->graph_schedules($btype,$schedule); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
18
application/views/node/graph_sessions.php
Normal file
18
application/views/node/graph_sessions.php
Normal file
@ -0,0 +1,18 @@
|
||||
<!-- $o = ORM::factory('NODE') -->
|
||||
<table class="box-full">
|
||||
<tr>
|
||||
<td class="head" colspan="2">Session Results</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="spacer"> </td>
|
||||
</tr>
|
||||
<?php foreach ($o->btypes() as $btype) { ?>
|
||||
<?php if ($o->act_bybtype($btype)) { ?>
|
||||
<?php foreach ($o->act_schedules($btype) as $schedule) { ?>
|
||||
<tr>
|
||||
<td><?php echo $o->graph_basessions($btype,$schedule); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</table>
|
@ -53,8 +53,12 @@ abstract class GoogleChart implements Iterator,Countable {
|
||||
break;
|
||||
case 'div': $this->_divname = array_shift($args);
|
||||
break;
|
||||
case 'height': $this->_height = array_shift($args);
|
||||
break;
|
||||
case 'title': $this->_title = array_shift($args);
|
||||
break;
|
||||
case 'width': $this->_width = array_shift($args);
|
||||
break;
|
||||
default:
|
||||
throw new Kohana_Exception('Unknown method :name',array(':name'=>$name));
|
||||
}
|
||||
|
@ -137,14 +137,15 @@ function drawChart".$this->_divname."() {
|
||||
private function series() {
|
||||
$return = array();
|
||||
$c = $this->seriescolors();
|
||||
$j = count($c);
|
||||
|
||||
$i = 0;
|
||||
foreach ($this->_axis as $l => $axis) {
|
||||
// @todo This shouldnt be hard coded
|
||||
if ($axis == 'yl')
|
||||
array_push($return,array('type'=>'bar','color'=>$c[$i],'targetAxisIndex'=>0));
|
||||
array_push($return,array('type'=>'bar','color'=>$c[$i%$j],'targetAxisIndex'=>0));
|
||||
else
|
||||
array_push($return,array('type'=>'line','color'=>$c[$i],'targetAxisIndex'=>1));
|
||||
array_push($return,array('type'=>'line','color'=>$c[$i%$j],'targetAxisIndex'=>1));
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user