- Timestamp:
- 06/01/05 16:55:14 (18 years ago)
- Location:
- trunk/web/addons/toga
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/toga/image.php
r117 r122 1 1 <?php 2 2 include_once "./libtoga.php"; 3 4 if ( !empty( $_GET ) ) { 5 extract( $_GET ); 6 } 3 7 4 8 $httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET ); … … 6 10 $clustername = $httpvars->getClusterName(); 7 11 12 if( isset($id) && ($id!='')) $filter = 'id'; 13 else if( isset($state) && ($state!='')) $filter='state'; 14 else if( isset($user) && ($user!='')) $filter='user'; 15 else if( isset($queue) && ($queue!='')) $filter='queue'; 16 8 17 function drawSmallClusterImage() { 9 18 10 $ic = new ClusterImage( $clustername , null);19 $ic = new ClusterImage( $clustername ); 11 20 $ic->draw(); 12 21 } … … 14 23 function drawBigClusterImage() { 15 24 16 $ic = new ClusterImage( $clustername, null ); 25 global $filter, $queue, $id, $user; 26 27 $ic = new ClusterImage( $clustername ); 28 switch( $filter ) { 29 30 case "id": 31 $ic->setFilter( 'jobid', $id ); 32 break; 33 case "user": 34 $ic->setFilter( 'owner', $user); 35 break; 36 case "queue": 37 $ic->setFilter( 'queue', $queue); 38 break; 39 default: 40 break; 41 } 17 42 $ic->draw(); 18 43 } -
trunk/web/addons/toga/index.php
r119 r122 35 35 global $page, $gridwalk, $clustername; 36 36 global $parentgrid, $physical, $hostname; 37 global $self, $filter ;37 global $self, $filter, $cluster_url, $get_metric_string; 38 38 39 39 if ( $context == "control" && $controlroom < 0 ) … … 129 129 if ( $clustername ) { 130 130 $url = rawurlencode($clustername); 131 $node_menu .= "<B><A HREF=\". /?c=".rawurlencode($clustername)."\">$clustername</A></B> ";132 //$node_menu .= "<B>></B>\n";131 $node_menu .= "<B><A HREF=\"../../?c=".rawurlencode($clustername)."\">$clustername</A></B> "; 132 $node_menu .= "<B>></B>\n"; 133 133 $node_menu .= hiddenvar("c", $clustername); 134 134 } 135 136 $node_menu .= "<B><A HREF=\"./?c=".rawurlencode($clustername)."\">Joblist</A></B> "; 135 137 136 138 if( count( $filter ) > 0 ) { -
trunk/web/addons/toga/libtoga.php
r117 r122 334 334 class NodeImage { 335 335 336 var $image, $x, $y, $hostname, $jobs, $tasks ;336 var $image, $x, $y, $hostname, $jobs, $tasks, $showinfo; 337 337 338 338 function NodeImage( $hostname ) { … … 345 345 $this->hostname = $hostname; 346 346 $this->cpus = $this->determineCpus(); 347 $this->showinfo = 1; 347 348 } 348 349 … … 400 401 } 401 402 403 function getHostname() { 404 return $this->hostname; 405 } 406 402 407 function getJobs() { 403 408 return $this->jobs; 404 409 } 405 410 411 function setShowinfo( $showinfo ) { 412 $this->showinfo = $showinfo; 413 } 414 406 415 function draw() { 407 416 408 global $SMALL_CLUSTERIMAGE_NODEWIDTH, $JOB_NODE_MARKING_ALLCPUS, $JOB_NODE_MARKING_SINGLECPU; 417 $this->drawSmall(); 418 } 419 420 function drawBig() { 421 422 } 423 424 function drawSmall() { 425 426 global $SMALL_CLUSTERIMAGE_NODEWIDTH; 409 427 global $JOB_NODE_MARKING; 410 428 411 $this->load = $this->determineLoad();412 413 if( !isset( $this->image ) or !isset( $this->x ) or !isset( $this->y ) ) {414 printf( "aborting\n" );415 printf( "x %d y %d load %f\n", $this->x, $this->y, $load );416 return;417 }418 419 429 $black_color = imageColorAllocate( $this->image, 0, 0, 0 ); 420 421 // Convert Ganglias Hexadecimal load color to a Decimal one422 //423 $load = $this->determineLoad();424 $my_loadcolor = $this->colorHex( load_color($load) );425 426 430 $size = $SMALL_CLUSTERIMAGE_NODEWIDTH; 427 431 428 432 imageFilledRectangle( $this->image, $this->x, $this->y, $this->x+($size), $this->y+($size), $black_color ); 429 imageFilledRectangle( $this->image, $this->x+1, $this->y+1, $this->x+($size-1), $this->y+($size-1), $my_loadcolor ); 430 431 $nr_jobs = count( $this->jobs ); 432 433 $node_mark = null; 434 435 if( count( $this->jobs ) > 0 ) 436 $node_mark = $JOB_NODE_MARKING; 437 438 // if( $this->tasks < $this->cpus ) 439 // $node_mark = $JOB_NODE_MARKING_SINGLECPU; 440 441 // else if( $this->tasks == $this->cpus ) 442 // $node_mark = $JOB_NODE_MARKING_ALLCPUS; 443 444 if( $node_mark ) 445 imageString( $this->image, 1, $this->x+(($size/2)-2), $this->y+(($size/2)-3), $node_mark, $black_color ); 433 434 if( $this->showinfo) { 435 436 $this->load = $this->determineLoad(); 437 438 if( !isset( $this->image ) or !isset( $this->x ) or !isset( $this->y ) ) { 439 printf( "aborting\n" ); 440 printf( "x %d y %d load %f\n", $this->x, $this->y, $load ); 441 return; 442 } 443 444 445 // Convert Ganglias Hexadecimal load color to a Decimal one 446 // 447 $load = $this->determineLoad(); 448 $usecolor = $this->colorHex( load_color($load) ); 449 imageFilledRectangle( $this->image, $this->x+1, $this->y+1, $this->x+($size-1), $this->y+($size-1), $usecolor ); 450 if( count( $this->jobs ) > 0 ) 451 imageString( $this->image, 1, $this->x+(($size/2)-2), $this->y+(($size/2)-3), $JOB_NODE_MARKING, $black_color ); 452 453 } else { 454 455 // White 456 $usecolor = imageColorAllocate( $this->image, 255, 255, 255 ); 457 imageFilledRectangle( $this->image, $this->x+1, $this->y+1, $this->x+($size-1), $this->y+($size-1), $usecolor ); 458 } 459 460 446 461 } 447 462 … … 470 485 471 486 var $dataget, $image, $clustername; 472 473 function ClusterImage( $clustername, $data_gather ) { 474 475 if( !isset( $data_gather ) ) 476 $this->dataget = new DataGatherer(); 477 else 478 $this->dataget = $data_gather; 479 487 var $filtername, $filtervalue; 488 489 function ClusterImage( $clustername ) { 490 491 $this->dataget = new DataGatherer(); 480 492 $this->clustername = $clustername; 493 $this->filtername = null; 494 $this->filtervalue = null; 495 } 496 497 function setFilter( $filtername, $filtervalue ) { 498 499 //printf( "filter set to %s = %s\n", $filtername, $filtervalue ); 500 $this->filtername = $filtername; 501 $this->filtervalue = $filtervalue; 502 } 503 504 function filterNodes( $jobs, $nodes ) { 505 506 $filtered_nodes = array(); 507 508 foreach( $nodes as $node ) { 509 510 $mynjobs = $node->getJobs(); 511 $hostname = $node->getHostname(); 512 513 if( $this->filtername ) { 514 foreach( $mynjobs as $myjob ) 515 516 if( $this->filtername == 'jobid' && $node->hasJob( $this->filtervalue) ) 517 $filtered_nodes[] = $hostname; 518 else if( $jobs[$myjob][$this->filtername] == $this->filtervalue && !in_array( $hostname, $filtered_nodes ) ) 519 $filtered_nodes[] = $hostname; 520 } else 521 $filtered_nodes[] = $hostname; 522 } 523 524 return $filtered_nodes; 481 525 } 482 526 … … 526 570 imageFill( $image, 0, 0, $colorwhite ); 527 571 572 $jobs = $mydatag->getJobs(); 573 //printf("filtername = %s\n", $filtername ); 574 $filtered_nodes = $this->filterNodes( $jobs, $nodes ); 575 576 //print_r($filtered_nodes); 577 528 578 for( $n = 0; $n < $node_rows; $n++ ) { 529 579 … … 536 586 $host = $nodes_hosts[$cur_node]; 537 587 588 538 589 if( isset( $nodes[$host] ) ) { 539 590 540 591 $nodes[$host]->setCoords( $x, $y ); 541 592 $nodes[$host]->setImage( $image ); 593 594 if( !in_array( $host, $filtered_nodes ) ) 595 $nodes[$host]->setShowinfo( 0 ); 596 542 597 $nodes[$host]->draw(); 543 598 } -
trunk/web/addons/toga/overview.php
r120 r122 1 1 <?php 2 global $GANGLIA_PATH, $clustername, $tpl, $filter ;2 global $GANGLIA_PATH, $clustername, $tpl, $filter, $cluster, $get_metric_string, $cluster_url; 3 3 4 4 $data_gatherer = new DataGatherer(); … … 6 6 //$tpl->assign( "self", "./index.php" ); 7 7 $tpl->assign( "clustername", $clustername ); 8 $tpl->assign( "clusterimage", "./image.php?c=".rawurlencode($clustername)."&view=big-clusterimage" );9 8 10 9 $data_gatherer->parseXML(); … … 14 13 $nodes = $data_gatherer->getNodes(); 15 14 15 $filter_image_url = ""; 16 16 17 foreach( $filter as $filtername => $filtervalue ) { 17 18 $tpl->assign( "f_".$filtername, $filtervalue ); 18 } 19 $filter_image_url .= "&$filtername=$filtervalue"; 20 } 21 22 $tpl->assign( "clusterimage", "./image.php?c=".rawurlencode($clustername)."&view=big-clusterimage".$filter_image_url ); 19 23 20 24 $tpl->assign("heartbeat", makeDate( $heartbeat ) ); … … 22 26 $pie = drawPie(); 23 27 $tpl->assign("pie", $pie ); 28 29 //if( !array_key_exists( 'id', $filter ) ) { 30 31 // $graph_args = "c=$cluster_url&$get_metric_string&st=$cluster[LOCALTIME]"; 32 // $tpl->newBlock( "average_graphs" ); 33 // $tpl->assign( "graph_args", $graph_args ); 34 //} 24 35 25 36 function timeToEpoch( $time ) { -
trunk/web/addons/toga/templates/overview.tpl
r121 r122 4 4 <TABLE> 5 5 <TR> 6 <TD >6 <TD ALIGN="CENTER"> 7 7 <IMG SRC="{clusterimage}"><BR> 8 8 reported: {heartbeat} 9 9 </TD> 10 <TD >10 <TD ALIGN="CENTER"> 11 11 <IMG SRC="{pie}"> 12 12 </TD>
Note: See TracChangeset
for help on using the changeset viewer.