Changeset 108 for trunk/web


Ignore:
Timestamp:
05/18/05 12:39:04 (19 years ago)
Author:
bastiaans
Message:

toga/toga-functions.php:

  • Working clusterimage with load colors!
  • Load colors seem a bit off though..
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/toga/toga-functions.php

    r107 r108  
    44include_once "$GANGLIA_PATH/conf.php";
    55include_once "$GANGLIA_PATH/functions.php";
     6include_once "$GANGLIA_PATH/ganglia.php";
     7
     8global $context;
     9$context = 'cluster';
     10
     11include_once "$GANGLIA_PATH/get_ganglia.php";
    612
    713if ( !empty( $_GET ) ) {
    814        extract( $_GET );
    915}
     16
     17global $metrics;
     18
     19//print_r($metrics);
    1020
    1121class HTTPVariables {
     
    318328
    319329        function draw() {
     330                global $metrics;
     331       
    320332                $myimg = $this->img;
    321333
     
    332344class NodeImage {
    333345
    334         var $image, $x, $y;
     346        var $image, $x, $y, $hostname;
    335347
    336348        function NodeImage( $image, $x, $y ) {
     
    360372        function setLoad( $load ) {
    361373                $this->load = $load;
     374        }
     375
     376        function setHostname( $hostname ) {
     377                $this->hostname = $hostname;
    362378        }
    363379
     
    385401        function draw() {
    386402
    387                 $cpus = $metrics[$this->hostname]["cpu_num"][VAL];
     403                global $metrics;
     404
     405                $cpus = $metrics[$this->hostname][cpu_num][VAL];
    388406                if (!$cpus) $cpus=1;
    389                 $load_one = $metrics[$this->hostname]["load_one"][VAL];
     407                $load_one = $metrics[$this->hostname][load_one][VAL];
    390408                $load = ((float) $load_one)/$cpus;
    391409
     
    406424                $mydatag->parseXML();
    407425
    408                 $max_width = 150;
     426                $max_width = 250;
    409427                $node_width = 12;
    410428
     
    451469                                if( isset( $nodes[$host] ) and ($cur_node <= $nodes_nr) ) {
    452470                                        $node = new NodeImage( $image, $x, $y );
     471                                        $node->setHostname( $host );
    453472                                        $node->draw();
    454473                                        //$nodes[$host]->setCoords( $x, $y );
Note: See TracChangeset for help on using the changeset viewer.