Index: trunk/web/addons/toga/toga-functions.php =================================================================== --- trunk/web/addons/toga/toga-functions.php (revision 103) +++ trunk/web/addons/toga/toga-functions.php (revision 104) @@ -1,2 +1,3 @@ +
$togavalue ) { + // printf( '%s=%s', $attrs[NAME], $attrs[VAL] ); + + + if( $name == 'CLUSTER' ) { + + $clustername = $attrs[VAL]; + + if( !isset( $clusters[$clustername] ) ) + $clusters[$clustername] = array(); + + } else if( $name == 'METRIC' and strstr( $attrs[NAME], 'TOGA' ) ) { + + if( strstr( $attrs[NAME], 'TOGA-HEARTBEAT' ) ) { + + $heartbeat['time'] = $attrs[VAL]; + printf( "heartbeat %s\n", $heartbeat['time'] ); + + } else if( strstr( $attrs[NAME], 'TOGA-JOB' ) ) { + + sscanf( $attrs[NAME], 'TOGA-JOB-%d', $jobid ); + + printf( "jobid %s\n", $jobid ); + + if( !isset( $jobs[$jobid] ) ) + $jobs[$jobid] = array(); + + $fields = explode( ' ', $attrs[VAL] ); + + foreach( $fields as $f ) { + $togavalues = explode( '=', $f ); + + $toganame = $togavalues[0]; + $togavalue = $togavalues[1]; + + printf( "toganame %s, togavalue %s\n", $toganame, $togavalue ); if( $toganame == 'nodes' ) { + if( !isset( $jobs[$toganame] ) ) + $jobs[$toganame] = array(); + $nodes = explode( ';', $togavalue ); foreach( $nodes as $node ) { - // Doe iets koels met $node + printf( "node %s\n", $node ); + $jobs[$toganame][] = new Node( $node ); } + } else { + + $jobs[$toganame] = $togavalue; + } - - $jobs[$toganame] = $togavalue; - } } - } } @@ -146,9 +175,18 @@ class Node { - var $img; - - function Node() { - + var $img, $hostname, $location; + + function Node( $hostname ) { + + $this->hostname = $hostname; $this->img = new NodeImg(); + } + + function setLocation( $location ) { + $this->location = $location; + } + + function setCpus( $cpus ) { + $this->cpus = $cpus; } } @@ -210,2 +248,3 @@ $my_data->parseXML(); ?> +