Changeset 518 for trunk/web


Ignore:
Timestamp:
03/08/08 21:51:57 (16 years ago)
Author:
bastiaans
Message:

libtoga.php:

  • dont run na code if info unavailable
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/job_monarch/libtoga.php

    r514 r518  
    889889                if( $name == "GANGLIA_XML" )
    890890                {
    891                         foreach( $this->down_nodes as $reported => $dnodes )
    892                         {
    893 
    894                                 if( $reported == $this->heartbeat['time'] )
     891                        if( sizeof( $this->down_nodes ) > 0 )
     892                        {
     893                                foreach( $this->down_nodes as $reported => $dnodes )
    895894                                {
    896                                         $domain = $dnodes[1];
    897 
    898                                         foreach( $dnodes[0] as $downhost )
     895
     896                                        if( $reported == $this->heartbeat['time'] )
    899897                                        {
    900                                                 $downhost = $this->makeHostname( $downhost, $domain );
    901 
    902                                                 if( isset( $nodes[$downhost] ) )
     898                                                $domain = $dnodes[1];
     899
     900                                                foreach( $dnodes[0] as $downhost )
    903901                                                {
    904                                                         // OMG PHP4 is fking stupid!
    905                                                         // $nodes[$downhost]->setDown( 1 ) won't work here..
    906                                                         //
    907                                                         $mynode = $nodes[$downhost];
    908                                                         $mynode->setDown( 1 );
    909                                                         $nodes[$downhost] = $mynode;
     902                                                        $downhost = $this->makeHostname( $downhost, $domain );
     903
     904                                                        if( isset( $nodes[$downhost] ) )
     905                                                        {
     906                                                                // OMG PHP4 is fking stupid!
     907                                                                // $nodes[$downhost]->setDown( 1 ) won't work here..
     908                                                                //
     909                                                                $mynode = $nodes[$downhost];
     910                                                                $mynode->setDown( 1 );
     911                                                                $nodes[$downhost] = $mynode;
     912                                                        }
    910913                                                }
    911914                                        }
     
    913916                        }
    914917
    915                         foreach( $this->offline_nodes as $reported => $onodes )
    916                         {
    917                                 if( $reported == $this->heartbeat['time'] )
     918                        if( sizeof( $this->offline_nodes ) > 0 )
     919                        {
     920                                foreach( $this->offline_nodes as $reported => $onodes )
    918921                                {
    919                                         $domain = $onodes[1];
    920 
    921                                         foreach( $onodes[0] as $offlinehost )
     922                                        if( $reported == $this->heartbeat['time'] )
    922923                                        {
    923                                                 $offlinehost = $this->makeHostname( $offlinehost, $domain );
    924 
    925                                                 if( isset( $nodes[$offlinehost] ) )
     924                                                $domain = $onodes[1];
     925
     926                                                foreach( $onodes[0] as $offlinehost )
    926927                                                {
    927                                                         // OMG PHP4 is fking stupid!
    928                                                         // $nodes[$offlinehost]->setDown( 1 ) won't work here..
    929                                                         //
    930                                                         $mynode = $nodes[$offlinehost];
    931                                                         $mynode->setOffline( 1 );
    932                                                         $nodes[$offlinehost] = $mynode;
     928                                                        $offlinehost = $this->makeHostname( $offlinehost, $domain );
     929
     930                                                        if( isset( $nodes[$offlinehost] ) )
     931                                                        {
     932                                                                // OMG PHP4 is fking stupid!
     933                                                                // $nodes[$offlinehost]->setDown( 1 ) won't work here..
     934                                                                //
     935                                                                $mynode = $nodes[$offlinehost];
     936                                                                $mynode->setOffline( 1 );
     937                                                                $nodes[$offlinehost] = $mynode;
     938                                                        }
    933939                                                }
    934940                                        }
Note: See TracChangeset for help on using the changeset viewer.