From 6f383220093c0b380fdca934494b856922943207 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 27 May 2011 18:44:44 +1000 Subject: [PATCH] Added Gantt Activity --- .../controller/lnapp/templatedefault.php | 11 +- application/classes/controller/node.php | 6 - application/classes/controller/server.php | 188 +++++++++++++++++ application/classes/controller/tree.php | 8 + application/classes/jpgraph.php | 4 + application/classes/jpgraph/gantt.php | 4 + application/classes/lnapp/jpgraph.php | 29 +++ application/classes/lnapp/jpgraph/gantt.php | 104 ++++++++++ application/classes/lnapp/sort.php | 105 ++++++++++ application/classes/sort.php | 4 + htdocs/gantt.activity.php | 116 ----------- htdocs/redir.php | 14 ++ htdocs/summary.gantt.php | 189 ------------------ lib/config_custom.php | 6 +- 14 files changed, 473 insertions(+), 315 deletions(-) create mode 100644 application/classes/controller/server.php create mode 100644 application/classes/jpgraph.php create mode 100644 application/classes/jpgraph/gantt.php create mode 100644 application/classes/lnapp/jpgraph.php create mode 100644 application/classes/lnapp/jpgraph/gantt.php create mode 100644 application/classes/lnapp/sort.php create mode 100644 application/classes/sort.php delete mode 100644 htdocs/gantt.activity.php create mode 100644 htdocs/redir.php delete mode 100644 htdocs/summary.gantt.php diff --git a/application/classes/controller/lnapp/templatedefault.php b/application/classes/controller/lnapp/templatedefault.php index 8477427..6a77a43 100644 --- a/application/classes/controller/lnapp/templatedefault.php +++ b/application/classes/controller/lnapp/templatedefault.php @@ -251,9 +251,14 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template { // Remove the extension from the filename $file = substr($file, 0, -(strlen($ext) + 1)); + $f = ''; + + // If our file is pathed with session, our file is in our session. + if ($fd = Session::instance()->get_once($this->request->param('file'))) { + $this->response->body($fd); // First try and find media files for the site_id - if ($f = Kohana::find_file(sprintf('media/%s',Config::siteid()), $file, $ext)) { + } elseif ($f = Kohana::find_file(sprintf('media/%s',Config::siteid()), $file, $ext)) { // Send the file content as the response $this->response->body(file_get_contents($f)); @@ -269,8 +274,8 @@ abstract class Controller_lnApp_TemplateDefault extends Controller_Template { // Set the proper headers to allow caching $this->response->headers('Content-Type',File::mime_by_ext($ext)); - $this->response->headers('Content-Length',(string)filesize($f)); - $this->response->headers('Last-Modified',date('r', filemtime($f))); + $this->response->headers('Content-Length',(string)$this->response->content_length()); + $this->response->headers('Last-Modified',date('r', $f ? filemtime($f) : time())); } } ?> diff --git a/application/classes/controller/node.php b/application/classes/controller/node.php index c688ef8..e060f2f 100644 --- a/application/classes/controller/node.php +++ b/application/classes/controller/node.php @@ -11,8 +11,6 @@ * @license http://phptsmadmin.sf.net/license.html */ class Controller_NODE extends Controller_TemplateDefault { - protected $control = array('Client Nodes'=>'node'); - /** * Default Index for Controller */ @@ -47,8 +45,6 @@ $(document).ready(function () {$("#node_name").change(function () { 'title'=>_('TSM Nodes'), 'body'=>$output, )); - - $this->template->content = Block::factory(); } public function action_detail($node_name=NULL) { @@ -88,8 +84,6 @@ $(document).ready(function () {$("#node_name").change(function () { 'title'=>_('Schedule Information'), 'body'=>$output, )); - - $this->template->content = Block::factory(); } } ?> diff --git a/application/classes/controller/server.php b/application/classes/controller/server.php new file mode 100644 index 0000000..09d76fb --- /dev/null +++ b/application/classes/controller/server.php @@ -0,0 +1,188 @@ +where_open() + ->where('START_TIME','>=',$start) + ->and_where('END_TIME','>=',$end) + ->where_close() + ->or_where_open() + ->where('END_TIME','<=',$end) + ->and_where('END_TIME','>=',$start) + ->or_where_close(); + + $graph = new JPGraph_Gantt; + + foreach ($ao->find_all() as $a) { + $sort = 10; + $csim = ''; + $caption = ''; + $wait = 0; // @todo + + switch ($a->ACTIVITY) { + case('TAPE MOUNT'): + $summary = sprintf('%s (%s)',$a->ACTIVITY,$a->DRIVE_NAME); + $csim = sprintf('%s (%s)',$a->VOLUME_NAME,$a->LAST_USE); + $sort = 1; + break; + + case('STGPOOL BACKUP'): + $summary = sprintf('%s (%s)',$a->ACTIVITY,$a->ENTITY); + $csim = sprintf('%3d MB. %ss Media wait',$a->BYTES/1024/1024,$a->MEDIAW); + $sort = 4; + break; + + case('ARCHIVE'): + $summary = sprintf('%s (%s)',$a->ACTIVITY,$a->ENTITY); + $csim = sprintf('%3d MB',$a->BYTES/1024/1024); + $sort = 3; + break; + + case('BACKUP'): + $summary = sprintf('%s (%s)',$a->ACTIVITY,$a->ENTITY); + $csim = sprintf('%3d MB',$a->BYTES/1024/1024); + $sort = 2; + break; + + case('RESTORE'): + $summary = sprintf('%s (%s)',$a->ACTIVITY,$a->ENTITY); + $csim = sprintf('%3d MB. %ss Media wait',$a->BYTES/1024/1024,$a->MEDIAW); + $sort = 2; + break; + + case('RETRIEVE'): + $summary = sprintf('%s (%s)',$a->ACTIVITY,$a->ENTITY); + $csim = sprintf('%3d MB. %ss Media wait',$a->BYTES/1024/1024,$a->MEDIAW); + $sort = 2; + break; + + case('FULL_DBBACKUP'): + $summary = $a->ACTIVITY; + $csim = sprintf('%3d MB. %ss Media wait',$a->BYTES/1024/1024,$a->MEDIAW); + break; + + case('RECLAMATION'): + $summary = $a->ACTIVITY.' ('.preg_replace('/^(.*)\s+\(.*\)$/','$1',$a->ENTITY).')'; + $csim = sprintf('%3d MB. %ss Media wait',$a->BYTES/1024/1024,$a->MEDIAW); + $sort = 4; + break; + + case('MIGRATION'): + $summary = $a->ACTIVITY.' ('.$a->ENTITY.')'; + $csim = sprintf('%3d MB. %ss Media wait',$a->BYTES/1024/1024,$a->MEDIAW); + $sort = 4; + break; + + case('MOVE NODEDATA'): + $summary = $a->ACTIVITY.' ('.$a->ENTITY.')'; + $csim = sprintf('%3d MB. %ss Media wait',$a->BYTES/1024/1024,$a->MEDIAW); + $sort = 4; + break; + + case('EXPIRATION'): + $summary = 'EXPIRATION PROCESSING'; + $caption = sprintf('%ss',$a->AFFECTED); + + default: + $summary = $a->ACTIVITY; + } + + $graph->add($summary,$a->START_TIME,$a->END_TIME) + ->sort($sort) + ->progress($wait) + ->caption($caption) + ->csim($csim); + } + + $graph->jpgraph->SetMargin(1,1,1,1); + $graph->jpgraph->SetMarginColor('#FFFFFF'); + $graph->jpgraph->SetFrame(FALSE,'#FFFFFF',3); + $graph->jpgraph->SetColor('#F6F6F8'); + + // We want to display day, hour and minute scales + $graph->jpgraph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR | GANTT_HMIN); + + $graph->jpgraph->hgrid->Show(); + $graph->jpgraph->hgrid->SetRowFillColor('#AAAACC@0.85'); + + // Setup hour format + $graph->jpgraph->scale->day->SetFontColor('white'); + $graph->jpgraph->scale->day->SetBackgroundColor('blue'); + $graph->jpgraph->scale->hour->SetFontColor('white'); + $graph->jpgraph->scale->hour->SetBackgroundColor('blue'); + $graph->jpgraph->scale->hour->SetIntervall(1); + $graph->jpgraph->scale->hour->SetStyle(HOURSTYLE_H24); + $graph->jpgraph->scale->minute->SetFontColor('white'); + $graph->jpgraph->scale->minute->SetBackgroundColor('blue'); + $graph->jpgraph->scale->minute->SetIntervall(30); + + $url = $graph->draw('gantt'); + + Block::add(array( + 'title'=>_('Server Gantt Activity'), + 'body'=>HTML::Image('media/'.$url,array('alt'=>_('Service Gantt Activity'))), + )); + } + + // @todo Other work in progress + public function xaction_gantt() { + $end = date('Y-m-d H:i'); + $start = date('Y-m-d H:i',time()-86400); + + $startActivites = array(); + $startActivities['811'] = array('start'=>'Expire Inventory'); + $startActivities['812'] = array('success'=>'Expire Inventory'); + $startActivities['2562'] = array('start'=>'Event Records Delete'); + $startActivities['2564'] = array('success'=>'Event Records Delete'); + $startActivities['2102'] = array('start'=>'Activity Log Delete'); + $startActivities['2102'] = array('success'=>'Activity Log Delete'); + $startActivities['2280'] = array('start'=>'DB Backup'); + $startActivities['4550'] = array('success'=>'DB Backup'); + $startActivities['406'] = array('start'=>'Session'); + $startActivities['403'] = array('success'=>'Session'); + + $ao = ORM::factory('ACTLOG') + ->where('DATE_TIME','>=',$start) + ->and_where('DATE_TIME','<=',$end) + ->and_where('ORIGINATOR','=','SERVER') + ->and_where('MSGNO','in',array_keys($startActivities)); + + $activity = array(); + foreach ($ao->find_all() as $a) { + # New Event. + if (isset($startActivities[$a->MSGNO]['start'])) { + $activity[$startActivities[$a->MSGNO]['start']][]['start'] = $a->DATE_TIME; + + } elseif (isset($startActivities[$a->MSGNO]['success'])) { + $item = (isset($activity[$startActivities[$a->MSGNO]['success']]) ? count($activity[$startActivities[$a->MSGNO]['success']])-1 : 0); + + # Is there a start event. + if (! isset($activity[$startActivities[$a->MSGNO]['success']][$item]['start'])) + $activity[$startActivities[$a->MSGNO]['success']][$item]['start'] = $a->DATE_TIME; + + $activity[$startActivities[$a->MSGNO]['success']][$item]['end'] = $a->DATE_TIME; + } + } + } +} +?> diff --git a/application/classes/controller/tree.php b/application/classes/controller/tree.php index 82f1d9c..8eac2bc 100644 --- a/application/classes/controller/tree.php +++ b/application/classes/controller/tree.php @@ -31,6 +31,14 @@ class Controller_Tree extends Controller_lnApp_Tree { 'attr_href'=>URL::Site('/node'), )); + array_push($data,array( + 'id'=>'activity', + 'name'=>'Server Activity Gantt', + 'state'=>'none', + 'attr_id'=>'1', + 'attr_href'=>URL::Site('/server/gantt'), + )); + return parent::action_json($id,$data); } } diff --git a/application/classes/jpgraph.php b/application/classes/jpgraph.php new file mode 100644 index 0000000..f722c71 --- /dev/null +++ b/application/classes/jpgraph.php @@ -0,0 +1,4 @@ + diff --git a/application/classes/jpgraph/gantt.php b/application/classes/jpgraph/gantt.php new file mode 100644 index 0000000..f1b7505 --- /dev/null +++ b/application/classes/jpgraph/gantt.php @@ -0,0 +1,4 @@ + diff --git a/application/classes/lnapp/jpgraph.php b/application/classes/lnapp/jpgraph.php new file mode 100644 index 0000000..fc972fc --- /dev/null +++ b/application/classes/lnapp/jpgraph.php @@ -0,0 +1,29 @@ + diff --git a/application/classes/lnapp/jpgraph/gantt.php b/application/classes/lnapp/jpgraph/gantt.php new file mode 100644 index 0000000..af017e8 --- /dev/null +++ b/application/classes/lnapp/jpgraph/gantt.php @@ -0,0 +1,104 @@ +jpgraph = new GanttGraph(0,0,'auto'); + return $this; + } + + // Add a new line item to the Gantt Chart + public function add($summary,$start,$end) { + $this->_count = count($this->_items); + + $this->_items[$this->_count]['summary'] = $summary; + $this->_items[$this->_count]['start'] = $start; + $this->_items[$this->_count]['end'] = $end; + + return $this; + } + + public function caption($value) { + $this->_items[$this->_count]['caption'] = $value; + + return $this; + } + + public function csim($value) { + $this->_items[$this->_count]['csim'] = $value; + + return $this; + } + + public function progress($value) { + $this->_items[$this->_count]['progress'] = $value; + + return $this; + } + + public function sort($value) { + $this->_items[$this->_count]['sort'] = $value; + + return $this; + } + + // This will compile the gantt and output a URL that has the image + public function draw($name) { + // Sort our items by sort criteria. + sort::MAsort($this->_items,'sort,summary',0); + + $c = 0; + $ls = ''; + foreach ($this->_items as $item) { + // Put a gap between our priority items. + if ($c AND ($lp != $item['sort'])) + $c++; + + if ($ls != $item['summary']) + $c++; + + $lp = $item['sort']; + $ls = $item['summary']; + + $activity = new GanttBar($c,$item['summary'],$item['start'],$item['end']); + $activity->progress->Set($item['progress']); + $activity->caption ->Set($item['caption']); + $activity->SetCSIMTarget('#',($item['csim'] ? $item['csim'] : 'NoCSIM')); + $activity->title->SetCSIMTarget('#',($item['csim'] ? $item['csim'] : 'NoCSIM')); + + $this->jpgraph->Add($activity); + } + + $tmpfile = '/tmp/'.$name.'.png'; + $file = 'session/'.$name.'.png'; + + $this->jpgraph->Stroke($tmpfile); + Session::instance()->set($file,file_get_contents($tmpfile)); + unlink($tmpfile); + + return $file; + } +} +?> diff --git a/application/classes/lnapp/sort.php b/application/classes/lnapp/sort.php new file mode 100644 index 0000000..7fe6259 --- /dev/null +++ b/application/classes/lnapp/sort.php @@ -0,0 +1,105 @@ +$key)) {\n"; + $code .= " asort(\$a->$key);\n"; + $code .= " \$aa = array_shift(\$a->$key);\n"; + $code .= " } else\n"; + $code .= " \$aa = \$a->$key;\n"; + + $code .= " if (is_array(\$b->$key)) {\n"; + $code .= " asort(\$b->$key);\n"; + $code .= " \$bb = array_shift(\$b->$key);\n"; + $code .= " } else\n"; + $code .= " \$bb = \$b->$key;\n"; + + $code .= " if (\$aa != \$bb)"; + if ($rev) + $code .= " return (\$aa < \$bb ? 1 : -1);\n"; + else + $code .= " return (\$aa > \$bb ? 1 : -1);\n"; + + $code .= "} else {\n"; + + $code .= " \$a = array_change_key_case(\$a);\n"; + $code .= " \$b = array_change_key_case(\$b);\n"; + + $key = strtolower($key); + + $code .= " if ((! isset(\$a['$key'])) && isset(\$b['$key'])) return 1;\n"; + $code .= " if (isset(\$a['$key']) && (! isset(\$b['$key']))) return -1;\n"; + + $code .= " if ((isset(\$a['$key'])) && (isset(\$b['$key']))) {\n"; + $code .= " if (is_array(\$a['$key'])) {\n"; + $code .= " asort(\$a['$key']);\n"; + $code .= " \$aa = array_shift(\$a['$key']);\n"; + $code .= " } else\n"; + $code .= " \$aa = \$a['$key'];\n"; + + $code .= " if (is_array(\$b['$key'])) {\n"; + $code .= " asort(\$b['$key']);\n"; + $code .= " \$bb = array_shift(\$b['$key']);\n"; + $code .= " } else\n"; + $code .= " \$bb = \$b['$key'];\n"; + + $code .= " if (\$aa != \$bb)\n"; + $code .= " if (is_numeric(\$aa) && is_numeric(\$bb)) {\n"; + + if ($rev) + $code .= " return (\$aa < \$bb ? 1 : -1);\n"; + else + $code .= " return (\$aa > \$bb ? 1 : -1);\n"; + + $code .= " } else {\n"; + + if ($rev) + $code .= " if ( (\$c = strcasecmp(\$bb,\$aa)) != 0 ) return \$c;\n"; + else + $code .= " if ( (\$c = strcasecmp(\$aa,\$bb)) != 0 ) return \$c;\n"; + + $code .= " }\n"; + $code .= " }\n"; + $code .= "}\n"; + } + + $code .= 'return $c;'; + + $MASORT_CACHE[$sortby] = create_function('$a, $b',$code); + } + + uasort($data,$MASORT_CACHE[$sortby]); + } +} +?> diff --git a/application/classes/sort.php b/application/classes/sort.php new file mode 100644 index 0000000..cccb437 --- /dev/null +++ b/application/classes/sort.php @@ -0,0 +1,4 @@ + diff --git a/htdocs/gantt.activity.php b/htdocs/gantt.activity.php deleted file mode 100644 index 080f01f..0000000 --- a/htdocs/gantt.activity.php +++ /dev/null @@ -1,116 +0,0 @@ -'Expire Inventory'); -$startActivities['812'] = array('success'=>'Expire Inventory'); -$startActivities['2562'] = array('start'=>'Event Records Delete'); -$startActivities['2564'] = array('success'=>'Event Records Delete'); -$startActivities['2102'] = array('start'=>'Activity Log Delete'); -$startActivities['2102'] = array('success'=>'Activity Log Delete'); -$startActivities['2280'] = array('start'=>'DB Backup'); -$startActivities['4550'] = array('success'=>'DB Backup'); -$startActivities['406'] = array('start'=>'Session'); -$startActivities['403'] = array('success'=>'Session'); - -# Admin schedules -$tsmActivitys = TSMQuery($_REQUEST['server_id'],"select date(DATE_TIME) as DATE,time(DATE_TIME) as TIME,MSGNO from ACTLOG where ORIGINATOR='SERVER' and DATE_TIME \> '$reportStart' and MSGNO in (".implode(",",array_keys($startActivities)).")"); - -foreach ($tsmActivitys as $tsmActivity) { - - $datetime = $tsmActivity['DATE']." ".(preg_replace('/(.*:.*):.*/',"$1",$tsmActivity['TIME'])); - $msgNum = $tsmActivity['MSGNO']; - # Do we know this message number? - if (isset($startActivities[$msgNum])) { - - # New Event. - if (isset($startActivities[$msgNum]['start'])) { - - $activity[$startActivities[$msgNum]['start']][]['start'] = $datetime; - - } else if (isset($startActivities[$msgNum]['success'])) { - $item = (isset($activity[$startActivities[$msgNum]['success']]) ? - count($activity[$startActivities[$msgNum]['success']])-1 : 0); - - # Is there a start event. - if (! isset($activity[$startActivities[$msgNum]['success']][$item]['start'])) { - $activity[$startActivities[$msgNum]['success']][$item]['start'] = $datetime; - } - $activity[$startActivities[$msgNum]['success']][$item]['end'] = $datetime; - - } else { - print "Che? Unknown index??"; - } - } else { - } - -} -// A new graph with automatic size -$graph = new GanttGraph(0,0,"auto"); - -$item = 0; - -# Admin Schedules -foreach ($activity as $tsmSchedAdmin => $value) { - - foreach ($value as $instance) { - -printf ("Drawing [%s] [%s] [%s] [%s]
",$item,$tsmSchedAdmin,$instance['start'],($instance['end'] ? $instance['end'] : $instance['start'])); - $activity = new GanttBar($item,$tsmSchedAdmin,$instance['start'],($instance['end'] ? $instance['end'] : $instance['start'])); - $item++; -$graph->Add($activity); - } -} - -$graph->SetMarginColor('white'); -$graph->SetFrame(false); - -// We want to display day, hour and minute scales -$graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR | GANTT_HMIN); - -$graph->hgrid->Show(); -$graph->hgrid->SetRowFillColor('darkred@0.85'); -$graph->hgrid->line->SetColor('red@0.85'); -$graph->hgrid->line->Show(false); - -// A new activity on row '0' -// Setup hour format -$graph->scale->hour->SetIntervall(1); -$graph->scale->hour->SetStyle(HOURSTYLE_H24); -$graph->scale->minute->SetIntervall(30); - -// Display the Gantt chart -$graph->Stroke(); - -die(); -# Block Title -$blockTitle = _('Server Status for').' '.TSMServerName($_REQUEST['server_id']); - -$blockBody = ''; - -# Client Details -$blockBody .= ''; - -#$blockBody .= sprintf('', -# count($tsmClientsTotal)); - -$blockBody .= ''; - -# End -$blockBody .= '
 Clients 
 '. -# classValue(_('%s clients registered to this TSM server.'),'value'). -# ' 
 
'; - -$left = ''; # Use default left blocks. -$centre = buildBlock("centre",$blockTitle,$blockBody); -$right = ''; # Use default right blocks. -print buildPage($left,$centre,$right); - -?> diff --git a/htdocs/redir.php b/htdocs/redir.php new file mode 100644 index 0000000..4317ec7 --- /dev/null +++ b/htdocs/redir.php @@ -0,0 +1,14 @@ + diff --git a/htdocs/summary.gantt.php b/htdocs/summary.gantt.php deleted file mode 100644 index 11de7ad..0000000 --- a/htdocs/summary.gantt.php +++ /dev/null @@ -1,189 +0,0 @@ -getValue('server','name')); - -$blockBody['node'] = '
'; -$blockBody['node'] .= ''; -$blockBody['node'] .= sprintf('',$app['server']->getIndex()); - -$blockBody['node'] .= 'From '; -$blockBody['node'] .= ''; -$blockBody['node'] .= ' '; -$blockBody['node'] .= 'To '; -$blockBody['node'] .= ''; -$blockBody['node'] .= ''; -$blockBody['node'] .= '
'; - -if ($form['from'] && $form['to']) { -initJPGraph(true); - -# A new graph with automatic size -$graph = new GanttGraph(0,0,'auto'); - -# A new activity on row '0' -$item = 0; -foreach ($summaryInfo->getSummary($form['from'],$form['to']) as $tsmActivity) { - $tsmCaption = ''; - $tsmCSIM = ''; - $waiting = 0; - $timestart = preg_replace('/(.*:.*):.*/','$1',$tsmActivity['START_TIME']); - $timeend = preg_replace('/(.*:.*):.*/','$1',$tsmActivity['END_TIME']); - $timeseconds = strtotime(preg_replace('/([0-9])\..*$/','$1',$tsmActivity['END_TIME'])) - - strtotime(preg_replace('/([0-9])\..*$/','$1',$tsmActivity['START_TIME'])); - if ($timeseconds) { - $waiting = $tsmActivity['MEDIAW']/$timeseconds; - } - - # It seems sometimes, the MEDIAW time can be larger than the activity time? - if ($waiting > 1) $waiting = 1; - - $priority = 10; - switch ($tsmActivity['ACTIVITY']) { - case('TAPE MOUNT'): - $summary = $tsmActivity['ACTIVITY'].' ('.$tsmActivity['DRIVE_NAME'].')'; - $tsmCSIM = sprintf('%s (%s)',$tsmActivity['VOLUME_NAME'],$tsmActivity['LAST_USE']); - $priority = 1; - break; - case('STGPOOL BACKUP'): - $summary = $tsmActivity['ACTIVITY'].' ('.$tsmActivity['ENTITY'].')'; - $tsmCSIM = sprintf('%3d MB. %ss Media wait',$tsmActivity['BYTES']/1024/1024,$tsmActivity['MEDIAW']); - $priority = 4; - break; - case('ARCHIVE'): - $summary = $tsmActivity['ACTIVITY'].' ('.$tsmActivity['ENTITY'].')'; - $tsmCSIM = sprintf('%3d MB',$tsmActivity['BYTES']/1024/1024); - $priority = 3; - break; - case('BACKUP'): - $summary = $tsmActivity['ACTIVITY'].' ('.$tsmActivity['ENTITY'].')'; - $tsmCSIM = sprintf('%3d MB',$tsmActivity['BYTES']/1024/1024); - $priority = 2; - break; - case('RESTORE'): - $summary = $tsmActivity['ACTIVITY'].' ('.$tsmActivity['ENTITY'].')'; - $tsmCSIM = sprintf('%3d MB. %ss Media wait',$tsmActivity['BYTES']/1024/1024,$tsmActivity['MEDIAW']); - $priority = 2; - break; - case('FULL_DBBACKUP'): - $summary = $tsmActivity['ACTIVITY']; - $tsmCSIM = sprintf('%3d MB. %ss Media wait',$tsmActivity['BYTES']/1024/1024,$tsmActivity['MEDIAW']); - break; - case('RECLAMATION'): - $summary = $tsmActivity['ACTIVITY'].' ('.preg_replace('/^(.*)\s+\(.*\)$/','$1',$tsmActivity['ENTITY']).')'; - $tsmCSIM = sprintf('%3d MB. %ss Media wait',$tsmActivity['BYTES']/1024/1024,$tsmActivity['MEDIAW']); - $priority = 4; - break; - case('MIGRATION'): - $summary = $tsmActivity['ACTIVITY'].' ('.$tsmActivity['ENTITY'].')'; - $tsmCSIM = sprintf('%3d MB. %ss Media wait',$tsmActivity['BYTES']/1024/1024,$tsmActivity['MEDIAW']); - $priority = 4; - break; - case('MOVE NODEDATA'): - $summary = $tsmActivity['ACTIVITY'].' ('.$tsmActivity['ENTITY'].')'; - $tsmCSIM = sprintf('%3d MB. %ss Media wait',$tsmActivity['BYTES']/1024/1024,$tsmActivity['MEDIAW']); - $priority = 4; - break; - case('EXPIRATION'): - $summary = 'EXPIRATION PROCESSING'; - $tsmCaption = sprintf('%ss',$tsmActivity['AFFECTED']); - default: $summary = $tsmActivity['ACTIVITY']; - } - - $lineitems[$summary][$item]['wait'] = $waiting; - $lineitems[$summary][$item]['summary'] = $summary; - $lineitems[$summary][$item]['start'] = $timestart; - $lineitems[$summary][$item]['end'] = $timeend; - $lineitems[$summary][$item]['csim'] = $tsmCSIM; - $lineitems[$summary][$item]['caption'] = $tsmCaption; - $lineitems[$summary]['priority'] = $priority; - $lineitems[$summary]['summary'] = $summary; - $item++; -} - -if ($lineitems) { - masort($lineitems,'priority,summary',1); - - $item=0; - foreach ($lineitems as $lineitem => $linedetails) { - - # Put a gap between our priority items. - if ($item && ($lastPriority <> $linedetails['priority'])) - $item++; - - foreach ($linedetails as $eventdetails) { - if (! is_array($eventdetails)) continue; - $activity = new GanttBar($item,$eventdetails['summary'],$eventdetails['start'],$eventdetails['end']); - $activity->progress->Set($eventdetails['wait']); - $activity->caption ->Set($eventdetails['caption']); - $activity->SetCSIMTarget('#',($eventdetails['csim'] ? $eventdetails['csim'] : 'NoCSIM')); - $activity->title->SetCSIMTarget('#',($eventdetails['csim'] ? $eventdetails['csim'] : 'NoCSIM')); - - $graph->Add($activity); - } - $item++; - $lastPriority = $linedetails['priority']; - } - - $graph->SetMarginColor('#eeeeff'); - $graph->SetFrame(true,'#eeeeff',0); - - // We want to display day, hour and minute scales - $graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR | GANTT_HMIN); - $graph->hgrid->Show(); - $graph->hgrid->SetRowFillColor('darkred@0.85'); - - // Setup hour format - $graph->scale->hour->SetIntervall(1); - $graph->scale->hour->SetStyle(HOURSTYLE_H24); - $graph->scale->minute->SetIntervall(30); - - $graph->scale->dividerh->SetWeight(3); - $graph->scale->dividerh->SetColor('navy'); - - // Display the Gantt chart - $imageFile = sprintf('%s/gantt.summary.%s.png',realpath($_SESSION[APPCONFIG]->getValue('image','path')),$app['server']->getIndex()); - $imageHTML = sprintf('%sgantt.summary.%s.png',$_SESSION[APPCONFIG]->getValue('image','pathurl'),$app['server']->getIndex()); - $graph->Stroke($imageFile); - -} else { - # @todo: Nice message about no data. -} - -$blockTitle['gantt'] = sprintf(_('Activity Summary for server %s'),$app['server']->getValue('server','name')); -$blockBody['gantt'] = '
'; -$blockBody['gantt'] .= $graph->GetHTMLImageMap('gantt.summary'); -$blockBody['gantt'] .= sprintf('',$imageHTML,$app['server']->getIndex()) ; -$blockBody['gantt'] .= '
'; -} - -# End -render_page($blockTitle,$blockBody); -?> diff --git a/lib/config_custom.php b/lib/config_custom.php index 4965c77..65c7e98 100644 --- a/lib/config_custom.php +++ b/lib/config_custom.php @@ -22,6 +22,10 @@ $config->configDefinition('command','libraryinfo',array( 'summary'=>'Library Info', 'desc'=>'Information on Automated Tape Libraries.', 'default'=>'library.info')); +$config->configDefinition('command','nodedetail',array( + 'summary'=>'Node Detail', + 'desc'=>'Detail of Node Storage Usage.', + 'default'=>'redir&page=node')); $config->configDefinition('command','nodeoccupancy',array( 'summary'=>'Node Occupancy', 'desc'=>'Summary of Node Occupancy.', @@ -37,7 +41,7 @@ $config->configDefinition('command','schedulegantt',array( $config->configDefinition('command','summarygantt',array( 'summary'=>'Activity Summary Gantt', 'desc'=>'Gantt view of todays activities.', - 'default'=>'summary.gantt')); + 'default'=>'redir&page=server/gantt')); $config->configDefinition('command','serverdb',array( 'summary'=>'Server DB Information', 'desc'=>'Database Information for TSM Server.',