getValue('server','name')); $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'] .= ' |