Changeset 163 for trunk/web/addons


Ignore:
Timestamp:
06/23/05 10:17:37 (19 years ago)
Author:
bastiaans
Message:

web/addons/toga/conf.php:

  • Set to actual gmetad port (was gmond's)

web/addons/toga/image.php:

  • clustername parse fix

web/addons/toga/libtoga.php:

web/addons/toga/overview.php:

  • Use clustername when getting data
Location:
trunk/web/addons/toga
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/toga/conf.php

    r129 r163  
    2424// by default localhost's gmetad
    2525//
    26 $DATA_SOURCE = '127.0.0.1:8649';
     26$DATA_SOURCE = '127.0.0.1:8651';
    2727
    2828// Is there a jobarchive?
  • trunk/web/addons/toga/image.php

    r124 r163  
    1010$clustername = $httpvars->getClusterName();
    1111
     12//printf("clustername = %s\n", $clustername );
    1213if( isset($id) && ($id!='')) $filter[id]=$id;
    1314if( isset($state) && ($state!='')) $filter[state]=$state;
     
    2324function drawBigClusterImage() {
    2425
    25         global $filter;
     26        global $filter, $clustername;
    2627
    2728        $ic = new ClusterImage( $clustername );
  • trunk/web/addons/toga/libtoga.php

    r152 r163  
    399399        var $xmlhandler, $data, $httpvars;
    400400
    401         function DataGatherer() {
     401        function DataGatherer( $cluster ) {
    402402
    403403                global $DATA_SOURCE;
    404                
     404       
     405                //printf("dg cluster = %s\n", $cluster );
    405406                $ds_fields = explode( ':', $DATA_SOURCE );
    406407                $ds_ip = $ds_fields[0];
     
    411412                $this->parser = xml_parser_create();
    412413                $this->httpvars = $httpvars;
    413                 $this->xmlhandler = new TorqueXMLHandler();
     414                $this->xmlhandler = new TorqueXMLHandler( $cluster );
    414415                xml_set_element_handler( $this->parser, array( &$this->xmlhandler, 'startElement' ), array( &$this->xmlhandler, 'stopElement' ) );
    415416        }
     
    452453class TorqueXMLHandler {
    453454
    454         var $clusters, $heartbeat, $nodes, $jobs;
    455 
    456         function TorqueXMLHandler() {
     455        var $clusters, $heartbeat, $nodes, $jobs, $clustername, $proc_cluster;
     456
     457        function TorqueXMLHandler( $clustername ) {
    457458                $jobs = array();
    458459                $clusters = array();
    459                 $nodes = array();
     460                $this->nodes = array();
    460461                $heartbeat = array();
     462                $this->clustername = $clustername;
     463                //printf(" cluster set to %s \n", $this->clustername );
    461464        }
    462465
     
    489492                $jobid = null;
    490493
    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 );
    492497
    493498                if( $name == 'CLUSTER' ) {
    494499
    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) {
    501508
    502509                        $hostname = $attrs[NAME];
    503510                        $location = $attrs[LOCATION];
     511                        //printf( "Found node %s\n", $hostname );
    504512
    505513                        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 ) {
    509517
    510518                        if( strstr( $attrs[NAME], 'TOGA-HEARTBEAT' ) ) {
     
    576584                                                                $my_node->addJob( $jobid, 1 );
    577585
    578                                                 $this->nodes[$host] = $my_node;
     586                                                $nodes[$host] = $my_node;
    579587                                        }
    580588                                }
     
    582590                }
    583591                $this->jobs = $jobs;
     592                //print_r( $nodes );
     593                $this->nodes = $nodes;
    584594        }
    585595
     
    625635
    626636        function getNodes() {
     637                //print_r( $this->nodes );
    627638                return $this->nodes;
    628639        }
     
    794805        function ClusterImage( $clustername ) {
    795806
    796                 $this->dataget = new DataGatherer();
     807                //printf( "image cluster = %s\n", $clustername );
     808                $this->dataget = new DataGatherer( $clustername );
    797809                $this->clustername = $clustername;
    798810                $this->filters = array();
  • trunk/web/addons/toga/overview.php

    r148 r163  
    55//$tpl->assign("_ROOT.summary", "" );
    66
    7 $data_gatherer = new DataGatherer();
     7$data_gatherer = new DataGatherer( $clustername );
    88
    99//$tpl->assign( "self", "./index.php" );
Note: See TracChangeset for help on using the changeset viewer.