I just noticed a mistake in my previous patch, I am not sure why, but
the assign function did not like it when I quoted the hash indices in
its second double-quoted value argument.  This new patch is the same as
the old one, but with differences on only two lines to correct this
mistake.

~Jason


On Wed, 2003-03-26 at 13:46, Jason A. Smith wrote:
> We had accidentally installed a new php.ini file on our webserver that
> had set the error_reporting to E_ALL.  This caused an enormous amount of
> warning messages to be written to apache's error log file, filling it up
> to the 2GB file size limit in just a few days causing apache to crash. 
> Since the vast majority of these warnings were about unquoted strings
> being used as array indices, I took the opportunity to fix them.  I have
> attached my patch against version 2.5.3 of ganglia-webfrontend.  This
> might be useful to prevent someone else from having the same problem if
> they make the same mistake that we did.
> 
> ~Jason
-- 
/------------------------------------------------------------------\
|  Jason A. Smith                          Email:  [EMAIL PROTECTED] |
|  Atlas Computing Facility, Bldg. 510M    Phone:  (631)344-4226   |
|  Brookhaven National Lab, P.O. Box 5000  Fax:    (631)344-7616   |
|  Upton, NY 11973-5000                                            |
\------------------------------------------------------------------/
diff -uNr ganglia-webfrontend-2.5.3-dist/cluster_view.php ganglia-webfrontend-2.5.3/cluster_view.php
--- ganglia-webfrontend-2.5.3-dist/cluster_view.php	Fri Mar  7 16:30:38 2003
+++ ganglia-webfrontend-2.5.3/cluster_view.php	Wed Mar 26 13:27:47 2003
@@ -8,7 +8,7 @@
 #
 $upcount=count($hosts[$cluster]);
 $downcount=count($hosts_down[$cluster]);
-$cpus=__reduce("cpu_num", __sum, $cluster);
+$cpus=__reduce("cpu_num", '__sum', $cluster);
 $Cs = $cpus>1 ? "s" : "";
 $Ns = $upcount>1 ? "s" : "";
 $be = $Ns ? "are" : "is";
@@ -22,9 +22,9 @@
    $tpl->assign("down_nodes", "There are no nodes down.");
 }
 
-$tpl->assign( "load_one", __reduce("load_one", __sum, $cluster));
-$tpl->assign( "load_five", __reduce("load_five", __sum, $cluster));
-$tpl->assign( "load_fifteen", __reduce("load_fifteen", __sum, $cluster));
+$tpl->assign( "load_one", __reduce("load_one", '__sum', $cluster));
+$tpl->assign( "load_five", __reduce("load_five", '__sum', $cluster));
+$tpl->assign( "load_fifteen", __reduce("load_fifteen", '__sum', $cluster));
 
 $clusterURL=rawurlencode($cluster);
 
@@ -37,7 +37,7 @@
    "SRC=\"./graph.php?g=cpu&z=medium&c=$clusterURL&$get_metric_string\">");
 
 $firsthost=key($metrics[$cluster][$metric]);
-$units=$metrics[$cluster][$metric][$firsthost][UNITS];
+$units=$metrics[$cluster][$metric][$firsthost]['UNITS'];
 $units=$units ? "($units)" : "";
 $tpl->assign("metric","$metric $units");
 
@@ -45,12 +45,12 @@
 if (is_array($hosts[$cluster])) {
       foreach( $hosts[$cluster] as $k => $v )
          {
-            $cpu_num  = $metrics[$cluster]["cpu_num"][$k][VAL];
+            $cpu_num  = $metrics[$cluster]["cpu_num"][$k]['VAL'];
             if(!$cpu_num || $cpu_num == 0)
                {
                   $cpu_num = 1;
                }
-            $load_one = $metrics[$cluster]["load_one"][$k][VAL];
+            $load_one = $metrics[$cluster]["load_one"][$k]['VAL'];
             $snapshot[$k] = $load_one/ $cpu_num;
          }
 
@@ -88,14 +88,14 @@
 switch ($sort)
 {
    case "descending":
-      __sort($metric, __sort_des, $cluster);
+      __sort($metric, '__sort_des', $cluster);
       break;
    case "by hostname":
       __sort_name($metric, $cluster);
       break;
    default:
    case "ascending":
-      __sort($metric, __sort_asc, $cluster);
+      __sort($metric, '__sort_asc', $cluster);
       break;
 }
 
@@ -105,7 +105,7 @@
 $max=0;
 $min=0;
 foreach ( $metrics[$cluster][$metric] as $host => $val ) {
-   if( $val[TYPE]=="string" or ($max_graphs > 0 and $i > $max_graphs )) {
+   if( $val['TYPE']=="string" or ($max_graphs > 0 and $i > $max_graphs )) {
       continue;
    }
    $rrd_dir = "$rrds/$cluster/$host";
@@ -136,9 +136,9 @@
       $host_url = rawurlencode($host);
 
       $host_link="<A HREF=\"?c=$clusterURL&amp;h=$host_url&amp;$get_metric_string\">$host</A>";
-      if ($val[TYPE]=="timestamp")
+      if ($val['TYPE']=="timestamp")
          {
-            $date = date("r", $val[VAL]);
+            $date = date("r", $val['VAL']);
             $cell="<td class=metric>".
                "<b>$host_link</b><br>".
                "<i>$metric:</i> <b>$date</b></td>";
@@ -147,8 +147,8 @@
                $tpl->assign("br","</tr><tr><td></td>");
             }
          }
-      elseif( $val[TYPE]=="string" or $val[SLOPE]=="zero" or 
-          $always_timestamp[$metric] or $always_constant[$metric] or
+      elseif( $val['TYPE']=="string" or $val['SLOPE']=="zero" or 
+          isset($always_timestamp[$metric]) or isset($always_constant[$metric]) or
           ($max_graphs > 0 and $i > $max_graphs ))
          {
             $cell="<td class=metric>".
diff -uNr ganglia-webfrontend-2.5.3-dist/functions.php ganglia-webfrontend-2.5.3/functions.php
--- ganglia-webfrontend-2.5.3-dist/functions.php	Fri Mar  7 16:30:38 2003
+++ ganglia-webfrontend-2.5.3/functions.php	Wed Mar 26 13:10:43 2003
@@ -45,8 +45,8 @@
 {
    global $clusters, $metrics;
 
-   $clustertime=$clusters[$cluster][LOCALTIME];
-   $boottime=$metrics[$cluster][boottime][$host][VAL];
+   $clustertime=$clusters[$cluster]['LOCALTIME'];
+   $boottime=$metrics[$cluster]['boottime'][$host]['VAL'];
 
    $uptimeS=$clustertime - $boottime;
    $uptimeD=intval($uptimeS/86400);
@@ -69,7 +69,7 @@
 {
    $rack=$rank=$plane=-1;
 
-   $loc=$attrs[LOCATION];
+   $loc=$attrs['LOCATION'];
    if ($loc) {
       sscanf($loc, "%d,%d,%d", $rack, $rank, $plane);
       #echo "Found LOCATION: $rack, $rank, $plane.<br>";
@@ -77,7 +77,7 @@
    if ($rack<0 or $rank<0) {
       # Try to parse the host name. Assumes a compute-<rack>-<rank>
       # naming scheme.
-      $n=sscanf($attrs[NAME], "compute-%d-%d", $rack, $rank);
+      $n=sscanf($attrs['NAME'], "compute-%d-%d", $rack, $rank);
       $plane=0;
    }
    return array($rack,$rank,$plane);
@@ -91,11 +91,11 @@
 #
 function __sort_asc ($a, $b)
    {
-      return ($a[VAL] > $b[VAL]);
+      return ($a['VAL'] > $b['VAL']);
    }
 function __sort_des ($a, $b)
    {
-      return ($a[VAL] < $b[VAL]);
+      return ($a['VAL'] < $b['VAL']);
    }
 
 function __sort_name ($metric, $cluster)
@@ -159,6 +159,7 @@
    $metric = func_get_arg(0);
    $function = func_get_arg(1);
    $cluster2reduce = array();
+   $reduction_val = 0;
 
    if( func_num_args() == 3 )
       {
@@ -183,9 +184,9 @@
             {
                foreach($metrics[$name][$metric] as $host => $v )
                   {
-                     if ($do_index) 
+                     if (isset($do_index)) 
                         {
-                           $new_val = $function($reduction_val, $v[VAL]);
+                           $new_val = $function($reduction_val, $v['VAL']);
                            if ($new_val != $reduction_val) 
                               {
                               $index = $host;
@@ -194,13 +195,13 @@
                         }
                      else
                         {
-                           $reduction_val = $function($reduction_val, $v[VAL]);
+                           $reduction_val = $function($reduction_val, $v['VAL']);
                         }
                   }
             }
       }
 
-   if ($do_index) {
+   if (isset($do_index)) {
       return array($reduction_val, $index);
    }
    else {
@@ -243,16 +244,16 @@
    global $get_metric_string;
    global $template_name;
 
-   $cpu_num   = $metrics[$cluster]["cpu_num"][$host][VAL];
+   $cpu_num   = $metrics[$cluster]["cpu_num"][$host]['VAL'];
    if(!$cpu_num || $cpu_num == 0)
       {
          $cpu_num = 1;
       }
-   $load_one  = $metrics[$cluster]["load_one"][$host][VAL];
+   $load_one  = $metrics[$cluster]["load_one"][$host]['VAL'];
    $value = $load_one/ $cpu_num;
 
    # Check if the host is down
-   if( $hosts_down[$cluster][$host] )
+   if( isset($hosts_down[$cluster][$host]) )
       {
          $image = template("images/node_dead.jpg");
       }
diff -uNr ganglia-webfrontend-2.5.3-dist/ganglia.php ganglia-webfrontend-2.5.3/ganglia.php
--- ganglia-webfrontend-2.5.3-dist/ganglia.php	Fri Mar  7 16:30:38 2003
+++ ganglia-webfrontend-2.5.3/ganglia.php	Wed Mar 26 12:29:22 2003
@@ -21,7 +21,7 @@
 # Timing the XML download and parsing may give some insight as to when this
 # server is becoming overloaded. Necessary because we do not trim the XML
 # tree, even in potentially large hierarchies. Gives time in seconds.
-$parsetime;
+$parsetime = 0;
 
 
 #
@@ -62,14 +62,14 @@
 # A counter to help summarize a tree of grids.
 $grid_depth = 0;
 # The name of our local grid.
-$self;
+$self = "";
 # A data structure to keep track of the Grid. A graph in adjacency-list
 # format. Only grids can have children, clusters are leaf nodes.
 $gridtree=array();
 # A stack and pointer for constructing the gridtree graph.
 $ancestors=array();
 # Stands for 'parent' or 'predecessor'.
-$p;
+$p = "";
 
 # True if the XML tree comes from a pre-grid gmetad. A new gmetad will
 # wrap its output in a <GRID> tag.
@@ -86,17 +86,17 @@
 
    if ($tagname == "GANGLIA_XML")
       {
-         $component = $attrs[SOURCE];
-         $version[$component] = $attrs[VERSION];
+         $component = $attrs['SOURCE'];
+         $version[$component] = $attrs['VERSION'];
       }
    else if ($tagname == "GRID")
       {
-         $gridname = $attrs[NAME];
+         $gridname = $attrs['NAME'];
          $allgrids[$gridname] = $attrs;
 
          #echo "Added grid $grid, parent is $p<br>";
-         #echo "Found a GRID: $attrs[NAME], grid_depth = $grid_depth<br>";
-         #echo "auth=$attrs[AUTHORITY]<br>";
+         #echo "Found a GRID: $attrs['NAME'], grid_depth = $grid_depth<br>";
+         #echo "auth=$attrs['AUTHORITY']<br>";
 
          if ($grid_depth==0) {
             $self = $gridname;
@@ -125,7 +125,7 @@
       }
    else if ($tagname == "CLUSTER")
       {
-         $cluster = $attrs[NAME];
+         $cluster = $attrs['NAME'];
          #echo "Adding cluster $cluster, parent is $p<br>";
 
          # In new gmetads, GRID is the first tag after GANGLIA_XML.
@@ -147,17 +147,17 @@
          }
 
          # To determine health of older (pre 2.5.0) gmond hosts.
-         $localtime = $attrs[LOCALTIME];
+         $localtime = $attrs['LOCALTIME'];
          $TTL = 15;
       }
    else if ($tagname == "HOST")
       {
-         $host = $attrs[NAME];
+         $host = $attrs['NAME'];
 
          /* Check if host is UP or DOWN and place in appropriate array */
          $host_up = TRUE;
-         $TN = $attrs[TN];
-         $TMAX = $attrs[TMAX];
+         $TN = $attrs['TN'];
+         $TMAX = $attrs['TMAX'];
          # The new (>2.5.0) method to determine life, as used by gmetad.
          if ($TN and $TMAX) {
             if ($TN > $TMAX*4) 
@@ -165,7 +165,7 @@
          }
          # The old method.
          else {
-            if (abs($localtime - $attrs[REPORTED]) > (4*$TTL))
+            if (abs($localtime - $attrs['REPORTED']) > (4*$TTL))
               $host_up = FALSE;
          }
       
@@ -193,22 +193,22 @@
             # Put host attributes in the metrics array.
             $foo = array(
                "NAME"=>"ip",
-               "VAL"=> $attrs[IP],
+               "VAL"=> $attrs['IP'],
                "TYPE"=>"string"
                );
-            $metrics[$cluster][$foo[NAME]][$host] = $foo;
+            $metrics[$cluster][$foo['NAME']][$host] = $foo;
             $foo = array(
                "NAME"=>"reported",
-               "VAL"=> $attrs[REPORTED],
+               "VAL"=> $attrs['REPORTED'],
                "TYPE"=>"timestamp"
                );
-            $metrics[$cluster][$foo[NAME]][$host] = $foo;
+            $metrics[$cluster][$foo['NAME']][$host] = $foo;
             $foo = array(
                "NAME"=>"gmond_started",
-               "VAL"=> $attrs[GMOND_STARTED],
+               "VAL"=> $attrs['GMOND_STARTED'],
                "TYPE"=>"timestamp"
                );
-            $metrics[$cluster][$foo[NAME]][$host] = $foo;
+            $metrics[$cluster][$foo['NAME']][$host] = $foo;
          }
 
          # Update top level summary
@@ -217,13 +217,13 @@
 
    else if ($tagname == "METRIC")
       { 
-         $metric = $attrs[NAME]; 
+         $metric = $attrs['NAME']; 
          if ($host_up) {
 
              if ($general_mode) {
                   # Keep summaries for each child grid.
-                  if (is_numeric($attrs[VAL])) {
-                      $grids[$grid][$metric] += $attrs[VAL];
+                  if (is_numeric($attrs['VAL'])) {
+                      $grids[$grid][$metric] += $attrs['VAL'];
                   }
              }
              else {
@@ -232,8 +232,8 @@
              }
 
             # Update top level summary.
-            if (is_numeric($attrs[VAL]))
-               $grids[$self][$metric] += $attrs[VAL];
+            if (is_numeric($attrs['VAL']))
+               $grids[$self][$metric] += $attrs['VAL'];
          }
       } 
 } 
@@ -279,7 +279,7 @@
    $parser = xml_parser_create();
    xml_set_element_handler($parser, "__start", "__end" );
 
-   $fp = fsockopen( $ip, $port, &$errno, &$errstr, $timeout);
+   $fp = fsockopen( $ip, $port, $errno, $errstr, $timeout);
    if (!$fp)
       {
          $error = "fsockopen error: $errstr";
@@ -302,7 +302,7 @@
             }
          fclose($fp);
          $end = gettimeofday();
-         $parsetime = ($end[sec] + $end[usec]/1e6) - ($start[sec] + $start[usec]/1e6);
+         $parsetime = ($end['sec'] + $end['usec']/1e6) - ($start['sec'] + $start['usec']/1e6);
       }
 
    return TRUE;
diff -uNr ganglia-webfrontend-2.5.3-dist/get_ganglia.php ganglia-webfrontend-2.5.3/get_ganglia.php
--- ganglia-webfrontend-2.5.3-dist/get_ganglia.php	Fri Mar  7 16:30:38 2003
+++ ganglia-webfrontend-2.5.3/get_ganglia.php	Wed Mar 26 12:51:44 2003
@@ -6,6 +6,7 @@
 #
 
 include_once "./ganglia.php";
+$standalone = FALSE;
 
 if (! Gmetad($ganglia_ip, $ganglia_port) )
    {
diff -uNr ganglia-webfrontend-2.5.3-dist/graph.php ganglia-webfrontend-2.5.3/graph.php
--- ganglia-webfrontend-2.5.3-dist/graph.php	Fri Mar  7 16:30:38 2003
+++ ganglia-webfrontend-2.5.3/graph.php	Wed Mar 26 12:55:59 2003
@@ -35,7 +35,7 @@
 # http://ganglia.mrcluster.org/graph.php?graph=blob&command=whoami;cat%20/etc/passwd
 #
 
-if($command)
+if(isset($command))
     {
       exit();
     }
diff -uNr ganglia-webfrontend-2.5.3-dist/header.php ganglia-webfrontend-2.5.3/header.php
--- ganglia-webfrontend-2.5.3-dist/header.php	Fri Mar  7 16:30:38 2003
+++ ganglia-webfrontend-2.5.3/header.php	Wed Mar 26 12:49:50 2003
@@ -18,7 +18,7 @@
 $tpl->prepare();
 
 // Maintain our path through the grid tree.
-$me = $self . "@" . $grids[$self][AUTHORITY];
+$me = $self . "@" . $grids[$self]['AUTHORITY'];
 
 if ($initgrid) 
    {
@@ -316,7 +316,7 @@
       $context_sorts[]="descending";
       $context_sorts[]="by hostname";
 
-      $sort_menu .= "<B>Sorted</B>&nbsp;&nbsp;<SELECT NAME=\"s\" OnChange=\"ganglia_form.submit();\">\n";
+      $sort_menu = "<B>Sorted</B>&nbsp;&nbsp;<SELECT NAME=\"s\" OnChange=\"ganglia_form.submit();\">\n";
       foreach ( $context_sorts as $v )
          { 
             $url = rawurlencode($v);
diff -uNr ganglia-webfrontend-2.5.3-dist/host_view.php ganglia-webfrontend-2.5.3/host_view.php
--- ganglia-webfrontend-2.5.3-dist/host_view.php	Fri Mar  7 16:30:38 2003
+++ ganglia-webfrontend-2.5.3/host_view.php	Fri Mar 28 11:44:17 2003
@@ -42,32 +42,32 @@
                 {
                   if(is_array($v1))
                      {
-                        $name  = $v1[NAME];
-                        if ($v1[TYPE] == "string" or $v1[TYPE]=="timestamp" or $always_timestamp[$name])
+                        $name  = $v1['NAME'];
+                        if ($v1['TYPE'] == "string" or $v1['TYPE']=="timestamp" or $always_timestamp[$name])
                            {
                               // Long gmetric name/values will disrupt the display here.
-                              if ($v1[SOURCE] == "gmond") $s_metrics[$name] = $v1;
+                              if ($v1['SOURCE'] == "gmond") $s_metrics[$name] = $v1;
                            }
-                        elseif ($v1[SLOPE] == "zero" or $always_constant[$name])
+                        elseif ($v1['SLOPE'] == "zero" or $always_constant[$name])
                            {
                               $c_metrics[$name] = $v1;
                            }
                         else
                            {
-                              $graphargs = "c=$clusterURL&h=$host&v=$v1[VAL]&m=$name&r=$range&z=medium&jr=$jobrange&js=$jobstart";
+                              $graphargs = "c=$clusterURL&h=$host&v=$v1['VAL']&m=$name&r=$range&z=medium&jr=$jobrange&js=$jobstart";
                               // Adding units to graph 2003 by Jason Smith <[EMAIL PROTECTED]>.
-                              if ($v1[UNITS]) {
-                                 $encodeUnits = rawurlencode($v1[UNITS]);
+                              if ($v1['UNITS']) {
+                                 $encodeUnits = rawurlencode($v1['UNITS']);
                                  $graphargs .= "&vl=$encodeUnits";
                               }
-                              $g_metrics[$name][graph] = "<IMG HEIGHT=\"147\" WIDTH=\"395\" ALT=\"$host $metric\" ".
+                              $g_metrics[$name]['graph'] = "<IMG HEIGHT=\"147\" WIDTH=\"395\" ALT=\"$host $metric\" ".
                                  "SRC=\"./graph.php?$graphargs\">";
                            }
                      }
                # Add the uptime metric for this host. Cannot be done in ganglia.php,
                # since it requires a fully-parsed XML tree. The classic contructor problem.
-               $s_metrics[uptime][TYPE] = "string";
-               $s_metrics[uptime][VAL] = uptime($host, $cluster);
+               $s_metrics['uptime']['TYPE'] = "string";
+               $s_metrics['uptime']['VAL'] = uptime($host, $cluster);
              }
            }
      }
@@ -80,13 +80,13 @@
      {
         $tpl->newBlock("string_metric_info");
         $tpl->assign("name", $name);
-        if( $v[TYPE]=="timestamp" or $always_timestamp[$name])
+        if( $v['TYPE']=="timestamp" or $always_timestamp[$name])
            {
-              $tpl->assign("value", date("r", $v[VAL]));
+              $tpl->assign("value", date("r", $v['VAL']));
            }
         else
            {
-              $tpl->assign("value", "$v[VAL] $v[UNITS]");
+              $tpl->assign("value", sprintf("%s %s",$v['VAL'],$v['UNITS']));
            }
      }
    }
@@ -98,7 +98,7 @@
      {
         $tpl->newBlock("const_metric_info");
         $tpl->assign("name", $name);
-        $tpl->assign("value", "$v[VAL] $v[UNITS]");
+        $tpl->assign("value", sprintf("%s %s",$v['VAL'],$v['UNITS']));
      }
    }
 
@@ -110,7 +110,7 @@
       foreach ( $g_metrics as $name => $v )
      {
         $tpl->newBlock("vol_metric_info");
-        $tpl->assign("graph", $v[graph]);
+        $tpl->assign("graph", $v['graph']);
         if($i++ %2)
           $tpl->assign("br", "<BR>");
      }
diff -uNr ganglia-webfrontend-2.5.3-dist/meta_view.php ganglia-webfrontend-2.5.3/meta_view.php
--- ganglia-webfrontend-2.5.3-dist/meta_view.php	Fri Mar  7 16:30:38 2003
+++ ganglia-webfrontend-2.5.3/meta_view.php	Wed Mar 26 12:45:31 2003
@@ -23,11 +23,11 @@
 {
    global $grids;
 
-   if ($grids[$source]) {
+   if (isset($grids[$source])) {
       return $grids[$source][$metric];
    }
    else {
-      return __reduce($metric, __sum, $source);
+      return __reduce($metric, '__sum', $source);
    }
 }
 
@@ -36,7 +36,7 @@
 {
    global $grids, $clusters;
 
-   if ($grids[$source]) {
+   if (isset($grids[$source])) {
       $val = $grids[$source][$metric];
    }
    else {
@@ -96,7 +96,7 @@
    $num_dead_nodes = source_count($key, "HOSTS_DOWN");
 
    $sourceURL = rawurlencode($key);
-   if ($grids[$key]) {
+   if (isset($grids[$key])) {
 
       # Is this the our own grid?
       if ($key==$self) {
@@ -122,7 +122,7 @@
       $graph_url = "c=$sourceURL&$get_metric_string";
       $url = "./?$graph_url";
       $alt_url = "<a href=\"./?p=2&$graph_url\">(physical view)</a>";
-      $localtime = "Cluster Localtime:<BR><B>" . date("F j, Y, g:i a", $clusters[$key][LOCALTIME]) .
+      $localtime = "Cluster Localtime:<BR><B>" . date("F j, Y, g:i a", $clusters[$key]['LOCALTIME']) .
          "</B><BR><BR>";
       $class = "cluster";
    }
@@ -136,7 +136,7 @@
 
    # I dont like this either, but we need to have private clusters because some
    # users are skittish about publishing the load info. 
-   if (!$private[$key]) {
+   if (!isset($private[$key])) {
       $tpl->assign("alt_view", "<FONT SIZE=\"-2\">$alt_url</FONT>");
       $tpl->assign("load_one", sprintf("%.2f", source_reduce($key, "load_one")));
       $tpl->assign("load_five", sprintf("%.2f", source_reduce($key, "load_five")));
@@ -172,11 +172,11 @@
    foreach ($sorted_sources as $c=>$value) {
       if ($c==$self) 
          continue;
-      if ($private[$c]) {
+      if (isset($private[$c])) {
          $Private[$c] = template("images/cluster_private.jpg");
          continue;
       }
-      if ($grids[$c])
+      if (isset($grids[$c]))
          $image = load_image("grid", $value);
       else
          $image = load_image("cluster", $value);
@@ -214,8 +214,8 @@
          $name = $names[$k];
          $nameurl=rawurlencode($name);
          $snaptable .= "<td valign=top align=center>";
-         if ($grids[$name]) {
-            $snaptable .= "<a href=\"" . $grids[$name][AUTHORITY] ."?gw=fwd&gs=$GridstackURL\">";
+         if (isset($grids[$name])) {
+            $snaptable .= "<a href=\"" . $grids[$name]['AUTHORITY'] ."?gw=fwd&gs=$GridstackURL\">";
          }
          else {
            $snaptable .= "<a href=\"./?c=$nameurl&$get_metric_string\">";
diff -uNr ganglia-webfrontend-2.5.3-dist/physical_view.php ganglia-webfrontend-2.5.3/physical_view.php
--- ganglia-webfrontend-2.5.3-dist/physical_view.php	Fri Mar  7 16:30:38 2003
+++ ganglia-webfrontend-2.5.3/physical_view.php	Wed Mar 26 13:30:11 2003
@@ -28,12 +28,12 @@
 #
 # Give the capacities of this cluster: total #CPUs, Memory, Disk, etc.
 #
-$CPUs = __reduce("cpu_num", __sum, $cluster);
+$CPUs = __reduce("cpu_num", '__sum', $cluster);
 # Divide by 1024^2 to get Memory in GB.
-$Memory = sprintf("%.1f GB",__reduce("mem_total", __sum, $cluster)/(float)1048576);
-$Disk = __reduce("disk_total", __sum, $cluster);
+$Memory = sprintf("%.1f GB",__reduce("mem_total", '__sum', $cluster)/(float)1048576);
+$Disk = __reduce("disk_total", '__sum', $cluster);
 $Disk = $Disk ? sprintf("%.1f GB", $Disk) : "Unknown"; 
-list($MostFull,$name) = __reduce("part_max_used", __max, $cluster);
+list($MostFull,$name) = __reduce("part_max_used", '__max', $cluster);
 $tpl->assign("CPUs", $CPUs);
 $tpl->assign("Memory", $Memory);
 $tpl->assign("Disk", $Disk);
@@ -84,12 +84,12 @@
       # The metrics we need for this node.
       # A megabyte of memory is 1024 KB. This differs from hard drives, where
       # one MB = 1000 bytes. Everyone agree this is a bad double-standard?
-      $mem_totalMB = intval(intval($M[mem_total][$name][VAL])/1024);
-      $load_one=$M[load_one][$name][VAL];
-      $cpu_speed=$M[cpu_speed][$name][VAL];
+      $mem_totalMB = intval(intval($M['mem_total'][$name]['VAL'])/1024);
+      $load_one=$M['load_one'][$name]['VAL'];
+      $cpu_speed=$M['cpu_speed'][$name]['VAL'];
 
       # Choose load color.
-      $cpu_num=$M[cpu_num][$name][VAL];
+      $cpu_num=$M['cpu_num'][$name]['VAL'];
       if (!$cpu_num) { $cpu_num=1; }
       $loadindex=intval($load_one/($loadscalar*$cpu_num))+1;
       # 10 is currently the highest allowed load index.
@@ -118,8 +118,8 @@
          $info = $hardware;
       }
       else if ($verbose > 2) {
-         $clustertime=$clusters[$cluster][LOCALTIME];
-         $heartbeat=$M[reported][$name][VAL];
+         $clustertime=$clusters[$cluster]['LOCALTIME'];
+         $heartbeat=$M['reported'][$name]['VAL'];
          $age = $clustertime - $heartbeat;
          $age .= "s";
          $info = "<font size=-2>Last heartbeat $age ago</font>";
@@ -171,7 +171,7 @@
       list($rack, $rank) = findlocation($v);
 
       if ($rack>=0 and $rank>=0) {
-         $racks[$rack][$rank]=array($v[NAME],"UP");
+         $racks[$rack][$rank]=array($v['NAME'],"UP");
          continue;
       }
       else {
@@ -179,7 +179,7 @@
          if (! ($i % 25)) {
             $unknownID--;
          }
-         $racks[$unknownID][] = array($v[NAME],"UP");
+         $racks[$unknownID][] = array($v['NAME'],"UP");
       }
    }
 }
@@ -187,7 +187,7 @@
    foreach ($hosts_down[$cluster] as $host=>$v) {
       list($rack, $rank) = findlocation($v);
       if ($rack>=0 and $rank>=0) {
-         $racks[$rack][$rank]=array($v[NAME],"DOWN");
+         $racks[$rack][$rank]=array($v['NAME'],"DOWN");
          continue;
       }
       else {
@@ -195,7 +195,7 @@
          if (! ($i % 25)) {
             $unknownID--;
          }
-         $racks[$unknownID][] = array($v[NAME],"DOWN");
+         $racks[$unknownID][] = array($v['NAME'],"DOWN");
       }
    }
 }
diff -uNr ganglia-webfrontend-2.5.3-dist/show_node.php ganglia-webfrontend-2.5.3/show_node.php
--- ganglia-webfrontend-2.5.3-dist/show_node.php	Fri Mar  7 16:30:38 2003
+++ ganglia-webfrontend-2.5.3/show_node.php	Wed Mar 26 13:26:24 2003
@@ -34,7 +34,7 @@
 # An array of [Metrics][Hostname][NAME|VAL|TYPE|UNITS|SOURCE].
 $M=$metrics[$cluster];
 
-$tpl->assign("ip", $M[ip][$name][VAL]);
+$tpl->assign("ip", $M['ip'][$name]['VAL']);
 
 # Find the host's physical location in the cluster.
 $hostattrs = ($state=="UP") ? $hosts[$cluster][$name] : $hosts_down[$cluster][$name];
@@ -43,30 +43,30 @@
 $tpl->assign("location",$location);
 
 # The metrics we need for this node.
-$mem_totalMB = intval(intval($M[mem_total][$name][VAL])/1024);
-$load_one=$M[load_one][$name][VAL];
-$load_five=$M[load_five][$name][VAL];
-$load_fifteen=$M[load_fifteen][$name][VAL];
-$cpu_user=$M[cpu_user][$name][VAL];
-$cpu_system=$M[cpu_system][$name][VAL];
-$cpu_idle=$M[cpu_idle][$name][VAL];
-$cpu_num=$M[cpu_num][$name][VAL];
+$mem_totalMB = intval(intval($M['mem_total'][$name]['VAL'])/1024);
+$load_one=$M['load_one'][$name]['VAL'];
+$load_five=$M['load_five'][$name]['VAL'];
+$load_fifteen=$M['load_fifteen'][$name]['VAL'];
+$cpu_user=$M['cpu_user'][$name]['VAL'];
+$cpu_system=$M['cpu_system'][$name]['VAL'];
+$cpu_idle=$M['cpu_idle'][$name]['VAL'];
+$cpu_num=$M['cpu_num'][$name]['VAL'];
 # Cannot be zero, since we use it as a divisor.
 if (!$cpu_num) { $cpu_num=1; }
-$cpu_speed=$M[cpu_speed][$name][VAL];
-$disk_total=$M[disk_total][$name][VAL];
-$disk_free=$M[disk_free][$name][VAL];
+$cpu_speed=$M['cpu_speed'][$name]['VAL'];
+$disk_total=$M['disk_total'][$name]['VAL'];
+$disk_free=$M['disk_free'][$name]['VAL'];
 $disk_use = $disk_total - $disk_free;
-$disk_units=$M[disk_total][$name][UNITS];
-$part_max_used=$M[part_max_used][$name][VAL];
+$disk_units=$M['disk_total'][$name]['UNITS'];
+$part_max_used=$M['part_max_used'][$name]['VAL'];
 # Disk metrics are newer (as of 2.5.0), so we check more carefully.
 $disk = ($disk_total) ? "Using $disk_use of $disk_total $disk_units" : "Unknown";
 $part_max = ($part_max_used) ? "$part_max_used% used." : "Unknown";
    
 
 # Compute time of last heartbeat from node's dendrite.
-$clustertime=$clusters[$cluster][LOCALTIME];
-$heartbeat=$M[reported][$name][VAL];
+$clustertime=$clusters[$cluster]['LOCALTIME'];
+$heartbeat=$M['reported'][$name]['VAL'];
 $age = $clustertime - $heartbeat;
 $s = ($age>1) ? "s" : "";
 $tpl->assign("age","$age second$s");
@@ -112,16 +112,16 @@
 $tpl->assign("idle",percentindex(100 - $cpu_idle));
 
 # Software metrics
-$os_name=$M[os_name][$name][VAL];
-$os_release=$M[os_release][$name][VAL];
-$machine_type=$M[machine_type][$name][VAL];
-$boottime=$M[boottime][$name][VAL];
+$os_name=$M['os_name'][$name]['VAL'];
+$os_release=$M['os_release'][$name]['VAL'];
+$machine_type=$M['machine_type'][$name]['VAL'];
+$boottime=$M['boottime'][$name]['VAL'];
 $booted=date("F j, Y, g:i a", $boottime);
 $uptime=uptime($name,$cluster);
 
 # Turning into MBs. A MB is 1024 bytes.
-$swap_free=$M[swap_free][$name][VAL]/1024.0;
-$swap_total=sprintf("%.1f", $M[swap_total][$name][VAL]/1024.0);
+$swap_free=$M['swap_free'][$name]['VAL']/1024.0;
+$swap_total=sprintf("%.1f", $M['swap_total'][$name]['VAL']/1024.0);
 $swap_used=sprintf("%.1f", $swap_total - $swap_free);
 
 $tpl->assign("OS","$os_name $os_release ($machine_type)");

Reply via email to