Ben,

Below is the patch I created to display all metrics regardless of which hosts might have different sets of metrics. It is essentially the same modifications that Richard previously described (I had just chosen a different variable name). However, it is a patch against 3.0.1 and not the latest version, so I don't know if it will apply cleanly. Luckily, the patch is very simple so there shouldn't be any problems getting it to work with the latest version.

Hope that helps.

--Rick

--------------------------
Rick Mohr
Systems Developer
Ohio Supercomputer Center



----- BEGIN PATCH -----
diff -Naur ganglia-3.0.1-orig/web/ganglia.php ganglia-3.0.1/web/ganglia.php
--- ganglia-3.0.1-orig/web/ganglia.php  2005-07-20 09:58:33.000000000 -0400
+++ ganglia-3.0.1/web/ganglia.php       2005-07-20 11:23:14.000000000 -0400
@@ -29,6 +29,10 @@
 # Context dependant structure.
 $metrics = array();

+# RFM - We want to keep track of all metrics even if different ones
+# appear on different nodes.
+$metric_names = array();
+
 # 1Key = "Component" (gmetad | gmond) = Version string
 $version = array();

@@ -108,7 +112,7 @@

 function start_cluster ($parser, $tagname, $attrs)
 {
-   global $metrics, $cluster, $self, $grid, $hosts_up, $hosts_down;
+   global $metrics, $metric_names, $cluster, $self, $grid, $hosts_up, 
$hosts_down;
    static $hostname;

    switch ($tagname)
@@ -145,6 +149,7 @@
          case "METRIC":
             $metricname = $attrs['NAME'];
             $metrics[$hostname][$metricname] = $attrs;
+            $metric_names[$metricname] = 1;
             break;

          default:
diff -Naur ganglia-3.0.1-orig/web/header.php ganglia-3.0.1/web/header.php
--- ganglia-3.0.1-orig/web/header.php   2005-07-20 09:58:33.000000000 -0400
+++ ganglia-3.0.1/web/header.php        2005-07-20 11:23:14.000000000 -0400
@@ -219,13 +219,12 @@

 if( $context == "cluster" )
    {
-   if (!count($metrics)) {
+   if (!count($metric_names)) {
echo "<h4>Cannot find any metrics for selected cluster \"$clustername\", exiting.</h4>\n";
       echo "Check ganglia XML tree (telnet $ganglia_ip $ganglia_port)\n";
       exit;
    }
-   $firsthost = key($metrics);
-   foreach ($metrics[$firsthost] as $m => $foo)
+   foreach ($metric_names as $m => $foo)
          $context_metrics[] = $m;
    foreach ($reports as $r => $foo)
          $context_metrics[] = $r;
----- END PATCH -----

Reply via email to