Changeset 163 for trunk/web/addons/toga/libtoga.php
- Timestamp:
- 06/23/05 10:17:37 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/toga/libtoga.php
r152 r163 399 399 var $xmlhandler, $data, $httpvars; 400 400 401 function DataGatherer( ) {401 function DataGatherer( $cluster ) { 402 402 403 403 global $DATA_SOURCE; 404 404 405 //printf("dg cluster = %s\n", $cluster ); 405 406 $ds_fields = explode( ':', $DATA_SOURCE ); 406 407 $ds_ip = $ds_fields[0]; … … 411 412 $this->parser = xml_parser_create(); 412 413 $this->httpvars = $httpvars; 413 $this->xmlhandler = new TorqueXMLHandler( );414 $this->xmlhandler = new TorqueXMLHandler( $cluster ); 414 415 xml_set_element_handler( $this->parser, array( &$this->xmlhandler, 'startElement' ), array( &$this->xmlhandler, 'stopElement' ) ); 415 416 } … … 452 453 class TorqueXMLHandler { 453 454 454 var $clusters, $heartbeat, $nodes, $jobs ;455 456 function TorqueXMLHandler( ) {455 var $clusters, $heartbeat, $nodes, $jobs, $clustername, $proc_cluster; 456 457 function TorqueXMLHandler( $clustername ) { 457 458 $jobs = array(); 458 459 $clusters = array(); 459 $ nodes = array();460 $this->nodes = array(); 460 461 $heartbeat = array(); 462 $this->clustername = $clustername; 463 //printf(" cluster set to %s \n", $this->clustername ); 461 464 } 462 465 … … 489 492 $jobid = null; 490 493 491 // printf( '%s=%s', $attrs[NAME], $attrs[VAL] ); 494 //printf( '%s=%s', $attrs[NAME], $attrs[VAL] ); 495 496 //printf( "clustername = %s proc_cluster = %s\n", $this->clustername, $this->proc_cluster ); 492 497 493 498 if( $name == 'CLUSTER' ) { 494 499 495 $clustername = $attrs[VAL]; 496 497 if( !isset( $clusters[$clustername] ) ) 498 $clusters[$clustername] = array(); 499 500 } else if( $name == 'HOST' ) { 500 $this->proc_cluster = $attrs[NAME]; 501 //printf( "Found cluster %s\n", $attrs[NAME] ); 502 //print_r( $attrs ); 503 504 //if( !isset( $clusters[$clustername] ) ) 505 // $clusters[$clustername] = array(); 506 507 } else if( $name == 'HOST' and $this->proc_cluster == $this->clustername) { 501 508 502 509 $hostname = $attrs[NAME]; 503 510 $location = $attrs[LOCATION]; 511 //printf( "Found node %s\n", $hostname ); 504 512 505 513 if( !isset( $this->nodes[$hostname] ) ) 506 $ this->nodes[$hostname] = new NodeImage( $hostname );507 508 } else if( $name == 'METRIC' and strstr( $attrs[NAME], 'TOGA' ) ) {514 $nodes[$hostname] = new NodeImage( $hostname ); 515 516 } else if( $name == 'METRIC' and strstr( $attrs[NAME], 'TOGA' ) and $this->proc_cluster == $this->clustername ) { 509 517 510 518 if( strstr( $attrs[NAME], 'TOGA-HEARTBEAT' ) ) { … … 576 584 $my_node->addJob( $jobid, 1 ); 577 585 578 $ this->nodes[$host] = $my_node;586 $nodes[$host] = $my_node; 579 587 } 580 588 } … … 582 590 } 583 591 $this->jobs = $jobs; 592 //print_r( $nodes ); 593 $this->nodes = $nodes; 584 594 } 585 595 … … 625 635 626 636 function getNodes() { 637 //print_r( $this->nodes ); 627 638 return $this->nodes; 628 639 } … … 794 805 function ClusterImage( $clustername ) { 795 806 796 $this->dataget = new DataGatherer(); 807 //printf( "image cluster = %s\n", $clustername ); 808 $this->dataget = new DataGatherer( $clustername ); 797 809 $this->clustername = $clustername; 798 810 $this->filters = array();
Note: See TracChangeset
for help on using the changeset viewer.