Index: /branches/0.4/web/addons/job_monarch/host_view.php
===================================================================
--- /branches/0.4/web/addons/job_monarch/host_view.php	(revision 761)
+++ /branches/0.4/web/addons/job_monarch/host_view.php	(revision 762)
@@ -25,12 +25,12 @@
 include_once "./libtoga.php";
 
-$my_dir = getcwd();
-
-global $context;
-
-$context = 'cluster';
-
 if( $view == "overview-host" )
 {
+    $my_dir = getcwd();
+
+    global $context;
+
+    $context = 'cluster';
+
     chdir( $GANGLIA_PATH );
 
@@ -107,4 +107,5 @@
         {
             $mymetrics = $metrics;
+            unset( $mymetrics['last_reported_timestamp'] ); // Ganglia bug?
             #print_r( $mymetrics );
         }
@@ -170,5 +171,5 @@
     $tpl_data->assign("node_view","./?p=2&c=$cluster_url&h=$hostname");
 
-    $tpl_data->assign("ip", $hosts_up[IP]);
+    $tpl_data->assign("ip", $hosts_up['IP']);
 
     #print_r( $mymetrics );
@@ -176,10 +177,10 @@
     foreach ($mymetrics as $name => $v)
     {
-        if ($v[TYPE] == "string" or $v[TYPE]=="timestamp" or $always_timestamp[$name])
+        if ($v['TYPE'] == "string" or $v['TYPE']=="timestamp" or $always_timestamp[$name] or $v['NAME']=='last_reported_timestamp')
         {
             # Long gmetric name/values will disrupt the display here.
-            if ($v[SOURCE] == "gmond") $s_metrics[$name] = $v;
-        }
-        else if ($v[SLOPE] == "zero" or $always_constant[$name])
+            if ($v['SOURCE'] == "gmond") $s_metrics[$name] = $v;
+        }
+        else if ($v['SLOPE'] == "zero" or $always_constant[$name])
         {
             $c_metrics[$name] = $v;
@@ -203,23 +204,23 @@
             }
             # Adding units to graph 2003 by Jason Smith <smithj4@bnl.gov>.
-            if ($v[UNITS]) 
-            {
-                $encodeUnits = rawurlencode($v[UNITS]);
+            if ($v['UNITS']) 
+            {
+                $encodeUnits = rawurlencode($v['UNITS']);
                 $graphargs .= "&vl=$encodeUnits";
             }
-            $g_metrics[$name][graph] = $graphargs;
+            $g_metrics[$name]['graph'] = $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($cluster[LOCALTIME] - $metrics[boottime][VAL]);
+    $s_metrics['uptime']['TYPE'] = "string";
+    $s_metrics['uptime']['VAL'] = uptime($cluster['LOCALTIME'] - $metrics['boottime']['VAL']);
 
     # Add the gmond started timestamps & last reported time (in uptime format) from
     # the HOST tag:
-    $s_metrics[gmond_started][TYPE] = "timestamp";
-    $s_metrics[gmond_started][VAL] = $hosts_up[GMOND_STARTED];
-    $s_metrics[last_reported][TYPE] = "string";
-    $s_metrics[last_reported][VAL] = uptime($cluster[LOCALTIME] - $hosts_up[REPORTED]);
+    $s_metrics['gmond_started']['TYPE'] = "timestamp";
+    $s_metrics['gmond_started']['VAL'] = $hosts_up['GMOND_STARTED'];
+    $s_metrics['last_reported']['TYPE'] = "string";
+    $s_metrics['last_reported']['VAL'] = uptime($cluster['LOCALTIME'] - $hosts_up['REPORTED']);
 
     # Show string metrics
@@ -232,11 +233,11 @@
             $metric_info = array();
             $metric_info["name"] = $name;
-            if( $v[TYPE]=="timestamp" or $always_timestamp[$name])
-            {
-                $metric_info["value"] = date("r", $v[VAL]);
+            if( $v['TYPE']=="timestamp" or $always_timestamp[$name])
+            {
+                $metric_info["value"] = date("r", $v['VAL']);
             }
             else
             {
-                $metric_info["value"] = "$v[VAL] $v[UNITS]";
+                $metric_info["value"] = $v['VAL']." ". $v['UNITS'];
             }
             $string_metric_info_loop[] = $metric_info;
@@ -254,5 +255,5 @@
             $const_info = array();
             $const_infp["name"] = $name;
-            $const_info["value"] = "$v[VAL] $v[UNITS]";
+            $const_info["value"] = $v[VAL]." ". $v[UNITS];
             $const_metric_info_loop[] = $const_info;
         }
@@ -270,5 +271,5 @@
         {
             $metric_info = array();
-            $metric_info["graphargs"] = $v[graph];
+            $metric_info["graphargs"] = $v['graph'];
             $metric_info["alt"] = "$hostname $name";
             $vol_metric_info_loop[] = $metric_info;
