Ignore:
Timestamp:
06/17/05 17:14:55 (19 years ago)
Author:
bastiaans
Message:

web/addons/toga/libtoga.php:

  • Small bugfixes
  • Added getRrdDirs and Files functions for graphs

web/addons/toga/templates/search.tpl:

  • Small rearrangement

web/addons/toga/index.php:

  • Outlining

web/addons/toga/search.php:

  • Fixed graphing output!


web/addons/toga/graph.php

  • Fixed to handle multiple RRD's from multiple timeperiods
File:
1 edited

Legend:

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

    r143 r145  
    22// If php is compiled without globals
    33//
    4 if ( !empty( $_GET ) ) {
    5         extract( $_GET );
    6 }
     4//if ( !empty( $_GET ) ) {
     5//        extract( $_GET );
     6//}
    77
    88class HTTPVariables {
     
    6060chdir( $GANGLIA_PATH );
    6161
    62 $context = 'cluster';
    63 
    6462include_once "./conf.php";
    6563include_once "./functions.php";
    6664include_once "./ganglia.php";
    67 //include_once "./get_context.php";
     65include_once "./get_context.php";
     66unset( $start );
     67$context = 'cluster';
    6868include_once "./get_ganglia.php";
    6969
     
    229229        var $rrdbin, $rrdvalues, $clustername, $hostname, $tempdir, $tarchdir, $metrics;
    230230
    231         function TarchRrd( $clustername, $rrdbin = '/usr/bin/rrdtool', $tarchdir = '/data/toga/rrds' ) {
     231        function TarchRrdGraph( $clustername, $hostname, $rrdbin = '/usr/bin/rrdtool', $tarchdir = '/data/toga/rrds' ) {
     232       
    232233                $this->rrdbin = $rrdbin;
    233234                $this->rrdvalues = array();
    234235                $this->tarchdir = $tarchdir;
     236                $this->clustername = $clustername;
     237                $this->hostname = $hostname;
    235238        }
    236239
     
    274277        function getTimePeriods( $start, $end ) {
    275278
     279                //printf("start = %s end = %s\n", $start, $end );
    276280                $times = array();
    277281                $dirlist = $this->dirList( $this->tarchdir . '/' . $this->clustername . '/' . $this->hostname );
     282
     283                //print_r( $dirlist );
     284
    278285                $first = 0;
    279286                $last = 9999999999999;
     
    287294                }
    288295
     296                //printf( "first = %s last = %s\n", $first, $last );
     297
    289298                foreach( $dirlist as $dir ) {
    290299
    291                         if( $dir >= $first and $dir <= $last and !array_key_exists( $dir, $times ) )
     300                        //printf( "dir %s ", $dir );
     301
     302                        if( $dir >= $first and $dir <= $last and !array_key_exists( $dir, $times ) ) {
     303                       
    292304                                $times[] = $dir;
    293                 }
     305                                //printf("newtime %s ", $dir );
     306
     307                        }
     308                }
     309
     310                //print_r( $times );
    294311
    295312                sort( $times );
    296313
     314                //print_r( $times );
     315
    297316                return $times;
     317        }
     318
     319        function getRrdDirs( $start, $stop ) {
     320
     321                //printf( "tarchdir = %s\n", $this->tarchdir );
     322                $timess = $this->getTimePeriods( $start, $stop );
     323                //print_r( $timess );
     324
     325                $rrd_files = array();
     326
     327                foreach( $timess as $time ) {
     328
     329                        $rrd_files[] = $this->tarchdir . '/' . $this->clustername . '/' . $this->hostname. '/'.$time;
     330                }
     331
     332                return $rrd_files;
     333        }
     334
     335        function getRrdFiles( $metric, $start, $stop ) {
     336
     337                $times = $this->getTimePeriods( $start, $stop );
     338
     339                $rrd_files = array();
     340
     341                foreach( $times as $time ) {
     342
     343                        $rrd_files[] = $this->tarchdir . '/' . $this->clustername . '/' . $this->hostname . '/' .$time. '/' . $metric. '.rrd';
     344                }
     345
     346                return $rrd_files;
    298347        }
    299348
     
    309358
    310359                //return $graph;
     360                return 0;
    311361        }
    312362}
Note: See TracChangeset for help on using the changeset viewer.