Added Gantt Activity
This commit is contained in:
@@ -1,116 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/htdocs/gantt.activity.php,v 1.6 2008/07/01 01:18:34 wurley Exp $
|
||||
|
||||
# Required Libraries
|
||||
require './common.php';
|
||||
initJPGraph(true);
|
||||
|
||||
# Defaults
|
||||
$reportEnd = strftime('%y-%m-%d %H:%M',time());
|
||||
$reportStart = strftime('%y-%m-%d %H:%M',time()-86400);
|
||||
|
||||
$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');
|
||||
|
||||
# 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]<BR>",$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 = '<table border="0" cellpadding="0" cellspacing="0" class="blockcitem">';
|
||||
|
||||
# Client Details
|
||||
$blockBody .= '<tr><th colspan=2 class="title"> Clients</th><th class="title"> </th></tr>';
|
||||
|
||||
#$blockBody .= sprintf('<tr><td> </td><td>'.
|
||||
# classValue(_('%s clients registered to this TSM server.'),'value').
|
||||
# '</td><td> </td></tr>',
|
||||
# count($tsmClientsTotal));
|
||||
|
||||
$blockBody .= '<tr><td colspan=3> </td></tr>';
|
||||
|
||||
# End
|
||||
$blockBody .= '</table>';
|
||||
|
||||
$left = ''; # Use default left blocks.
|
||||
$centre = buildBlock("centre",$blockTitle,$blockBody);
|
||||
$right = ''; # Use default right blocks.
|
||||
print buildPage($left,$centre,$right);
|
||||
|
||||
?>
|
14
htdocs/redir.php
Normal file
14
htdocs/redir.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/htdocs/schedule.gantt.php,v 1.4 2009/04/19 04:00:59 wurley Exp $
|
||||
|
||||
# @todo: Hotlink the hostname to the detail script.
|
||||
|
||||
# Required Libraries
|
||||
require './common.php';
|
||||
|
||||
$base = preg_replace('/htdocs\/cmd.php/','',$_SERVER['SCRIPT_NAME']);
|
||||
if ($_REQUEST['page'])
|
||||
header(sprintf('Location: %s%s',$base,$_REQUEST['page']));
|
||||
|
||||
# End
|
||||
?>
|
@@ -1,189 +0,0 @@
|
||||
<?php
|
||||
// $Header: /cvsroot/phptsmadmin/phpTSMadmin/htdocs/summary.gantt.php,v 1.4 2009/04/19 04:00:59 wurley Exp $
|
||||
|
||||
# @todo: Hotlink the hostname to the detail script.
|
||||
|
||||
# Required Libraries
|
||||
require './common.php';
|
||||
$form['from'] = get_request('from','REQUEST',false,date('Y-m-d',time()-86400));
|
||||
$form['to'] = get_request('to','REQUEST',false,date('Y-m-d'));
|
||||
|
||||
# Defaults
|
||||
$reportEnd = strftime('%Y-%m-%d 23:59',time());
|
||||
$reportStart = strftime('%Y-%m-%d 00:00',time()-86400);
|
||||
$summaryInfo = objectCache('summaryinfo');
|
||||
|
||||
# List of Clients.
|
||||
$blockTitle['node'] = sprintf(_('Select DATE RANGE on %s'),$app['server']->getValue('server','name'));
|
||||
|
||||
$blockBody['node'] = '<form action="cmd.php">';
|
||||
$blockBody['node'] .= '<input type="hidden" name="cmd" value="summary.gantt" />';
|
||||
$blockBody['node'] .= sprintf('<input type="hidden" name="index" value="%s" />',$app['server']->getIndex());
|
||||
|
||||
$blockBody['node'] .= 'From ';
|
||||
$blockBody['node'] .= '<select name="from">';
|
||||
foreach ($summaryInfo->getSummaryRange() as $date) {
|
||||
$blockBody['node'] .= sprintf('<option id="%s" %s>%s</option>',
|
||||
$date,
|
||||
$date == $form['from'] ? 'selected' : '',
|
||||
$date);
|
||||
}
|
||||
$blockBody['node'] .= '</select>';
|
||||
$blockBody['node'] .= ' ';
|
||||
$blockBody['node'] .= 'To ';
|
||||
$blockBody['node'] .= '<select name="to">';
|
||||
foreach ($summaryInfo->getSummaryRange() as $date) {
|
||||
$blockBody['node'] .= sprintf('<option id="%s" %s>%s</option>',
|
||||
$date,
|
||||
$date == $form['to'] ? 'selected' : '',
|
||||
$date);
|
||||
}
|
||||
$blockBody['node'] .= '</select>';
|
||||
$blockBody['node'] .= '<input align="left" type="submit" name="submit" value="Go" />';
|
||||
$blockBody['node'] .= '</form>';
|
||||
|
||||
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'] = '<table class="result"><tr><td>';
|
||||
$blockBody['gantt'] .= $graph->GetHTMLImageMap('gantt.summary');
|
||||
$blockBody['gantt'] .= sprintf('<img src="%s" ISMAP USEMAP="#gantt.summary" border=0 />',$imageHTML,$app['server']->getIndex()) ;
|
||||
$blockBody['gantt'] .= '</td></tr></table>';
|
||||
}
|
||||
|
||||
# End
|
||||
render_page($blockTitle,$blockBody);
|
||||
?>
|
Reference in New Issue
Block a user