- Timestamp:
- 03/25/13 21:41:14 (11 years ago)
- Location:
- branches/0.4/web/addons/job_monarch
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/web/addons/job_monarch/graph.php
r739 r751 23 23 */ 24 24 25 global $ metrics, $rrds, $range, $start, $r, $conf, $m;25 global $rrds, $range, $start, $r, $conf, $m; 26 26 $range = $r; 27 27 28 28 include "./libtoga.php"; 29 30 $my_dir = getcwd(); 31 32 global $context; 33 34 $context = 'cluster'; 35 36 chdir( $GANGLIA_PATH ); 37 38 include "./ganglia.php"; 39 include "./get_ganglia.php"; 40 41 chdir( $my_dir ); 29 42 30 43 if ( !empty( $_GET ) ) -
branches/0.4/web/addons/job_monarch/host_view.php
r740 r751 24 24 25 25 include_once "./libtoga.php"; 26 27 $my_dir = getcwd(); 28 29 global $context; 30 31 $context = 'cluster'; 32 33 chdir( $GANGLIA_PATH ); 34 35 include "./ganglia.php"; 36 include "./get_ganglia.php"; 37 38 chdir( $my_dir ); 26 39 27 40 function datetimeToEpoch( $datetime ) -
branches/0.4/web/addons/job_monarch/libtoga.php
r750 r751 108 108 include_once "./eval_conf.php"; 109 109 include_once "./functions.php"; 110 include_once "./ganglia.php";111 110 include_once "./get_context.php"; 112 111 112 global $GLOBALS, $conf, $metrics, $version, $rrdtool_version, $context; 113 114 // ganglia start 115 $metrics = array(); 116 $version = array(); 117 118 $version["webfrontend"] = $GLOBALS["ganglia_version"]; 119 120 # Get rrdtool version 121 $rrdtool_version = array(); 122 exec($conf['rrdtool'], $rrdtool_version); 123 $rrdtool_version = explode(" ", $rrdtool_version[0]); 124 $rrdtool_version = $rrdtool_version[1]; 125 $version["rrdtool"] = "$rrdtool_version"; 126 127 // ganglia end 128 113 129 $context = 'cluster'; 114 include_once "./get_ganglia.php";115 130 116 131 // Back to our PHP … … 129 144 // Ganglia's array of host metrics 130 145 // 131 global $ metrics, $hosts_up;146 global $hosts_up; 132 147 global $start; 133 148 … … 554 569 } 555 570 571 function getMetrics() 572 { 573 $handler = $this->xmlhandler; 574 return $handler->getMetrics(); 575 } 556 576 function getNodes() 557 577 { … … 606 626 $this->clusters = array(); 607 627 $this->nodes = array(); 628 $this->metrics = array(); 608 629 $this->heartbeat = array(); 609 630 $this->down_nodes = array(); … … 611 632 $this->clustername = $clustername; 612 633 $this->proc_cluster = null; 634 $this->proc_hostname = null; 613 635 $this->fqdn = 1; 614 636 } … … 696 718 function startElement( $parser, $name, $attrs ) 697 719 { 698 699 if( isset( $attrs['TN'] ) ) 700 { 701 if ( $attrs['TN'] ) 702 { 703 // Ignore dead metrics. Detect and mask failures. 704 if ( $attrs['TN'] > $attrs['TMAX'] * 4 ) 705 { 706 return null; 707 } 708 } 709 } 720 global $cluster, $metrics; 710 721 711 722 $jobid = null; … … 713 724 if( $name == 'CLUSTER' ) 714 725 { 726 // ganglia start 727 $cluster = $attrs; 728 // ganglia end 729 715 730 $this->proc_cluster = $attrs['NAME']; 716 731 //printf("set proc cluster to %s\n", $attrs['NAME'] ); … … 725 740 if( $name == 'HOST' ) 726 741 { 742 // ganglia start 727 743 $hostname = $attrs['NAME']; 744 $this->proc_hostname = $hostname; 745 746 # Pseudo metrics - add useful HOST attributes like gmond_started & last_reported to the metrics list: 747 $metrics[$hostname]['gmond_started']['NAME'] = "GMOND_STARTED"; 748 $metrics[$hostname]['gmond_started']['VAL'] = $attrs['GMOND_STARTED']; 749 $metrics[$hostname]['gmond_started']['TYPE'] = "timestamp"; 750 $metrics[$hostname]['last_reported']['NAME'] = "REPORTED"; 751 $metrics[$hostname]['last_reported']['VAL'] = uptime($cluster['LOCALTIME'] - $attrs['REPORTED']); 752 $metrics[$hostname]['last_reported']['TYPE'] = "string"; 753 $metrics[$hostname]['last_reported_timestamp']['NAME'] = "REPORTED TIMESTAMP"; 754 $metrics[$hostname]['last_reported_timestamp']['VAL'] = $attrs['REPORTED']; 755 $metrics[$hostname]['last_reported_timestamp']['TYPE'] = "uint32"; 756 $metrics[$hostname]['ip_address']['NAME'] = "IP"; 757 $metrics[$hostname]['ip_address']['VAL'] = $attrs['IP']; 758 $metrics[$hostname]['ip_address']['TYPE'] = "string"; 759 $metrics[$hostname]['location']['NAME'] = "LOCATION"; 760 $metrics[$hostname]['location']['VAL'] = $attrs['LOCATION']; 761 $metrics[$hostname]['location']['TYPE'] = "string"; 762 // ganglia end 728 763 729 764 //printf( "host %s\n", $hostname ); … … 736 771 return null; 737 772 } 738 if( $name == 'METRIC' and ( strpos( $attrs['NAME'], 'zplugin_monarch' ) !== false ) ) 739 { 773 774 if( $name == 'METRIC' ) 775 { 776 $hostname = $this->proc_hostname; 777 778 // ganglia start 779 $metricname = rawurlencode($attrs['NAME']); 780 $metrics[$hostname][$metricname] = $attrs; 781 // ganglia end 782 783 if ( strpos( $attrs['NAME'], 'zplugin_monarch' ) === false ) 784 { 785 return null; 786 } 787 740 788 if( strpos( $attrs['NAME'], 'zplugin_monarch_heartbeat' ) !== false ) 741 789 {
Note: See TracChangeset
for help on using the changeset viewer.