- Timestamp:
- 02/04/10 13:57:28 (14 years ago)
- Location:
- trunk/web/addons/job_monarch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/job_monarch/image.php
r648 r651 23 23 */ 24 24 25 ini_set("memory_limit","1G");26 set_time_limit(0);25 //ini_set("memory_limit","1G"); 26 //set_time_limit(0); 27 27 28 28 include_once "./libtoga.php"; … … 46 46 $mySession->checkSession(); 47 47 48 $session = &$mySession->getSession();48 $session = $mySession->getSession(); 49 49 $myXML = $session['data']; 50 50 -
trunk/web/addons/job_monarch/libtoga.php
r649 r651 34 34 $this->restvars = array(); 35 35 36 $this->clustername = $httpvars['c']? $httpvars['c'] : $getvars['c'];37 $this->metricname = $httpvars['m']? $httpvars['m'] : $getvars['m'];36 $this->clustername = isset( $httpvars['c'] ) ? $httpvars['c'] : $getvars['c']; 37 $this->metricname = isset( $httpvars['m'] ) ? $httpvars['m'] : $getvars['m']; 38 38 39 39 if( count( $httpvars ) > 0 ) … … 84 84 85 85 $CLUSTER_CONFS = array(); 86 87 ini_set("memory_limit","1024000000"); 88 set_time_limit(0); 86 89 87 90 // Monarch's conf … … 559 562 function getData() 560 563 { 561 $errstr ;562 $errno 563 $timeout 564 $errstr = ''; 565 $errno = 0; 566 $timeout = 3; 564 567 565 568 $fp = fsockopen( $this->ip, $this->port, $errno, $errstr, $timeout ); … … 582 585 583 586 stream_set_timeout( $fp, 30 ); 587 588 $data = ''; 584 589 585 590 while ( !feof( $fp ) ) … … 601 606 { 602 607 $this->cluster = $cluster; 603 $this->httpvars = $httpvars;608 //$this->httpvars = $httpvars; 604 609 } 605 610 606 611 function parseXML( $data ) 607 612 { 608 $this->parser = xml_parser_create();613 //$this->parser = xml_parser_create(); 609 614 $this->xmlhandler = new TorqueXMLHandler( $this->cluster ); 610 615 611 xml_parser_set_option( $this->parser, XML_OPTION_CASE_FOLDING, 0 ); 612 xml_set_element_handler( $this->parser, array( &$this->xmlhandler, 'startElement' ), array( &$this->xmlhandler, 'stopElement' ) ); 613 614 if ( !xml_parse( $this->parser, $data ) ) 615 { 616 $error = sprintf( 'XML error: %s at %d', xml_error_string( xml_get_error_code( $this->parser ) ), xml_get_current_line_number( $this->parser ) ); 617 } 616 preg_match_all( '/<HOST (.*)?>/', $data, $hosts ); 617 unset( $hosts[1] ); 618 preg_match_all( '/<METRIC NAME="MONARCH-(.*)?\>/', $data, $metrics ); 619 unset( $metrics[1] ); 620 621 //print_r( $metrics ); 622 //print_r( $hosts ); 623 624 $togas = $metrics[0]; 625 626 //print_r( $togas ); 627 628 foreach( $togas as $mid=>$metric ) 629 { 630 // printf( "%s\n", $metric ); 631 preg_match( '/<METRIC NAME="MONARCH-(.*?)" VAL="(?<toga>\d+)" /', $metric, $toga ); 632 //print_r( $toga ); 633 } 634 635 //xml_parser_set_option( $this->parser, XML_OPTION_CASE_FOLDING, 0 ); 636 //xml_parser_set_option( $this->parser, XML_OPTION_SKIP_WHITE, 1 ); 637 //xml_set_element_handler( $this->parser, array( &$this->xmlhandler, 'startElement' ), array( &$this->xmlhandler, 'stopElement' ) ); 638 639 //if ( !xml_parse( $this->parser, $data ) ) 640 //{ 641 // $error = sprintf( 'XML error: %s at %d', xml_error_string( xml_get_error_code( $this->parser ) ), xml_get_current_line_number( $this->parser ) ); 642 //} 643 //xml_parser_free( $this->parser ); 618 644 } 619 645
Note: See TracChangeset
for help on using the changeset viewer.