Index: branches/0.3/web/addons/job_monarch/libtoga.php
===================================================================
--- branches/0.3/web/addons/job_monarch/libtoga.php	(revision 650)
+++ branches/0.3/web/addons/job_monarch/libtoga.php	(revision 652)
@@ -34,6 +34,6 @@
 		$this->restvars		= array();
 
-		$this->clustername	= $httpvars["c"] ? $httpvars["c"] : $getvars["c"];
-		$this->metricname	= $httpvars["m"] ? $httpvars["m"] : $getvars["m"];
+		$this->clustername	= isset( $httpvars["c"] ) ? $httpvars["c"] : $getvars["c"];
+		$this->metricname	= isset( $httpvars["m"] ) ? $httpvars["m"] : $getvars["m"];
 
 		if( count( $httpvars ) > 0 )
@@ -84,4 +84,7 @@
 
 $CLUSTER_CONFS	= array();
+
+ini_set("memory_limit","1024000000");
+set_time_limit(0);
 
 // Monarch's conf
@@ -475,7 +478,7 @@
 	function getData()
 	{
-		$errstr;
-		$errno = 0;
-		$timeout = 3;
+		$errstr		= '';
+		$errno		= 0;
+		$timeout	= 3;
 
 		$fp = fsockopen( $this->ip, $this->port, $errno, $errstr, $timeout );
@@ -679,10 +682,13 @@
 		$nodes = $this->nodes;
 
-		if ( $attrs['TN'] )
-		{
-			// Ignore dead metrics. Detect and mask failures.
-			if ( $attrs['TN'] > $attrs['TMAX'] * 4 )
-			{
-				return;
+		if( isset( $attrs['TN'] ) )
+		{
+			if ( $attrs['TN'] )
+			{
+				// Ignore dead metrics. Detect and mask failures.
+				if ( $attrs['TN'] > $attrs['TMAX'] * 4 )
+				{
+					return;
+				}
 			}
 		}
Index: branches/0.3/web/addons/job_monarch/overview.php
===================================================================
--- branches/0.3/web/addons/job_monarch/overview.php	(revision 650)
+++ branches/0.3/web/addons/job_monarch/overview.php	(revision 652)
@@ -255,10 +255,10 @@
 		$myjobs		= $node->getJobs();
 		$myhost		= $node->getHostname();
-		$node_cpus	= $metrics[$myhost]["cpu_num"][VAL];
+		$node_cpus	= $metrics[$myhost]["cpu_num"]['VAL'];
 		$job_cpu	= 0;
 
 		foreach( $myjobs as $myjob ) 
 		{
-			$job_cpu	+= (int) $jobs[$myjob][ppn] ? $jobs[$myjob][ppn] : 1;
+			$job_cpu	+= (int) $jobs[$myjob]['ppn'] ? $jobs[$myjob]['ppn'] : 1;
 		}
 
@@ -289,9 +289,9 @@
 		$nr_node_jobs 	= count( $node_jobs );
 		$myhost 	= $node->getHostname();
-		$node_cpus	= $metrics[$myhost]["cpu_num"][VAL];
+		$node_cpus	= $metrics[$myhost]["cpu_num"]['VAL'];
 
 		foreach( $node_jobs as $myjob )
 		{
-			$job_cpu		= (int) $jobs[$myjob][ppn] ? $jobs[$myjob][ppn] : 1;
+			$job_cpu		= (int) $jobs[$myjob]['ppn'] ? $jobs[$myjob]['ppn'] : 1;
 
 			// Determine the weight of this job
@@ -314,5 +314,5 @@
 				else if( $piefilter == 'user' )
 				{
-					if( $jobs[$myjob][owner] != $filter[$piefilter] )
+					if( $jobs[$myjob]['owner'] != $filter[$piefilter] )
 					{
 						$countjob = 0;
@@ -357,5 +357,5 @@
 			{
 
-				$qname		= $jobs[$myjob][queue];
+				$qname		= $jobs[$myjob]['queue'];
 
 				if( !isset( $queues[$qname] ) )
@@ -426,24 +426,24 @@
 		foreach( $jobs as $jobid => $jobattrs ) 
 		{
-				$state		= $jobattrs[status];
-				$user 		= $jobattrs[owner];
-				$queue 		= $jobattrs[queue];
-				$name 		= $jobattrs[name];
-				$req_cpu 	= $jobattrs[requested_time];
-				$req_memory 	= $jobattrs[requested_memory];
+				$state		= $jobattrs['status'];
+				$user 		= $jobattrs['owner'];
+				$queue 		= $jobattrs['queue'];
+				$name 		= $jobattrs['name'];
+				$req_cpu 	= $jobattrs['requested_time'];
+				$req_memory 	= $jobattrs['requested_memory'];
 
 				if( $state == 'R' )
 				{
-					$nodes = count( $jobattrs[nodes] );
+					$nodes = count( $jobattrs['nodes'] );
 				}
 				else
 				{
-					$nodes = $jobattrs[nodes];
-				}
-
-				$ppn 		= (int) $jobattrs[ppn] ? $jobattrs[ppn] : 1;
+					$nodes = $jobattrs['nodes'];
+				}
+
+				$ppn 		= (int) $jobattrs['ppn'] ? $jobattrs['ppn'] : 1;
 				$cpus 		= $nodes * $ppn;
-				$queued_time 	= (int) $jobattrs[queued_timestamp];
-				$start_time 	= (int) $jobattrs[start_timestamp];
+				$queued_time 	= (int) $jobattrs['queued_timestamp'];
+				$start_time 	= (int) $jobattrs['start_timestamp'];
 				$runningtime 	= $report_time - $start_time;
 
@@ -634,14 +634,14 @@
 		$report_time 	= $jobs[$jobid][reported];
 
-		if( $jobs[$jobid][status] == 'R' )
+		if( $jobs[$jobid]['status'] == 'R' )
 		{
-			$nodes = count( $jobs[$jobid][nodes] );
+			$nodes = count( $jobs[$jobid]['nodes'] );
 		}
-		else if( $jobs[$jobid][status] == 'Q' )
+		else if( $jobs[$jobid]['status'] == 'Q' )
 		{
-			$nodes = $jobs[$jobid][nodes];
+			$nodes = $jobs[$jobid]['nodes'];
 		}
 
-		$ppn 		= (int) $jobs[$jobid][ppn] ? $jobs[$jobid][ppn] : 1;
+		$ppn 		= (int) $jobs[$jobid]['ppn'] ? $jobs[$jobid]['ppn'] : 1;
 		$cpus 		= $nodes * $ppn;
 
@@ -650,7 +650,7 @@
 			$display_job	= 1;
 
-			if( $jobs[$jobid][status] == 'R' ) 
-			{
-				foreach( $jobs[$jobid][nodes] as $tempnode ) 
+			if( $jobs[$jobid]['status'] == 'R' ) 
+			{
+				foreach( $jobs[$jobid]['nodes'] as $tempnode ) 
 				{
 					$all_used_nodes[] = $tempnode;
@@ -660,5 +660,5 @@
 			$used_cpus += $cpus;
 
-			if( $jobs[$jobid][status] == 'R' ) 
+			if( $jobs[$jobid]['status'] == 'R' ) 
 			{
 				$running_cpus 	+= $cpus;
@@ -668,5 +668,5 @@
 				$found_node_job	= 0;
 
-				foreach( $jobs[$jobid][nodes] as $tempnode ) 
+				foreach( $jobs[$jobid]['nodes'] as $tempnode ) 
 				{
 					$running_name_nodes[] = $tempnode;
@@ -676,12 +676,12 @@
 						//$filter[host] = $hostname;
 
-						$domain_len 	= 0 - strlen( $jobs[$jobid][domain] );
+						$domain_len 	= 0 - strlen( $jobs[$jobid]['domain'] );
 						$hostnode 	= $tempnode;
 
 						if( $use_fqdn == 1)
 						{
-							if( substr( $hostnode, $domain_len ) != $jobs[$jobid][domain] ) 
+							if( substr( $hostnode, $domain_len ) != $jobs[$jobid]['domain'] ) 
 							{
-								$hostnode = $hostnode. '.'. $jobs[$jobid][domain];
+								$hostnode = $hostnode. '.'. $jobs[$jobid]['domain'];
 							}
 						}
@@ -700,5 +700,5 @@
 			}
 
-			if( $jobs[$jobid][status] == 'Q' ) 
+			if( $jobs[$jobid]['status'] == 'Q' ) 
 			{
 				if( isset( $hostname ) && $hostname != '' )
@@ -719,13 +719,13 @@
 					$display_job = 0;
 				}
-				else if( $filtername == 'state' && $jobs[$jobid][status] != $filtervalue )
+				else if( $filtername == 'state' && $jobs[$jobid]['status'] != $filtervalue )
 				{
 					$display_job = 0;
 				}
-				else if( $filtername == 'queue' && $jobs[$jobid][queue] != $filtervalue )
+				else if( $filtername == 'queue' && $jobs[$jobid]['queue'] != $filtervalue )
 				{
 					$display_job = 0;
 				}
-				else if( $filtername == 'user' && $jobs[$jobid][owner] != $filtervalue )
+				else if( $filtername == 'user' && $jobs[$jobid]['owner'] != $filtervalue )
 				{
 					$display_job = 0;
@@ -741,13 +741,13 @@
 				$last_displayed_job 	= $jobid;
 
-				$tpl->assign( "state", $jobs[$jobid][status] );
+				$tpl->assign( "state", $jobs[$jobid]['status'] );
 
 				$fullstate 		= '';
 
-				if( $jobs[$jobid][status] == 'R' ) 
+				if( $jobs[$jobid]['status'] == 'R' ) 
 				{
 					$fullstate 	= "Running";
 				} 
-				else if( $jobs[$jobid][status] == 'Q' ) 
+				else if( $jobs[$jobid]['status'] == 'Q' ) 
 				{
 					$fullstate 	= "Queued";
@@ -756,8 +756,8 @@
 				$tpl->assign( "fullstate", $fullstate );
 				
-				$tpl->assign( "user", $jobs[$jobid][owner] );
-				$tpl->assign( "queue", $jobs[$jobid][queue] );
-
-				$fulljobname 		= $jobs[$jobid][name];
+				$tpl->assign( "user", $jobs[$jobid]['owner'] );
+				$tpl->assign( "queue", $jobs[$jobid]['queue'] );
+
+				$fulljobname 		= $jobs[$jobid]['name'];
 				$shortjobname 		= '';
 
@@ -793,12 +793,12 @@
 				}
 
-				$domain 		= $jobs[$jobid][domain];
-
-				$tpl->assign( "req_cpu", makeTime( timeToEpoch( $jobs[$jobid][requested_time] ) ) );
+				$domain 		= $jobs[$jobid]['domain'];
+
+				$tpl->assign( "req_cpu", makeTime( timeToEpoch( $jobs[$jobid]['requested_time'] ) ) );
 
 				if( $COLUMN_REQUESTED_MEMORY ) 
 				{
 					$tpl->newBlock( "column_req_mem" );
-					$tpl->assign( "req_memory", $jobs[$jobid][requested_memory] );
+					$tpl->assign( "req_memory", $jobs[$jobid]['requested_memory'] );
 					$tpl->gotoBlock( "node" );
 				}
@@ -808,5 +808,5 @@
 				{
 					$tpl->newBlock( "column_queued" );
-					$tpl->assign( "queued", makeDate( $jobs[$jobid][queued_timestamp] ) );
+					$tpl->assign( "queued", makeDate( $jobs[$jobid]['queued_timestamp'] ) );
 					$tpl->gotoBlock( "node" );
 				}
@@ -817,5 +817,5 @@
 				}
 
-				$ppn 			= (int) $jobs[$jobid][ppn] ? $jobs[$jobid][ppn] : 1;
+				$ppn 			= (int) $jobs[$jobid]['ppn'] ? $jobs[$jobid]['ppn'] : 1;
 				$cpus 			= $nodes * $ppn;
 
@@ -823,5 +823,5 @@
 				$tpl->assign( "cpus", $cpus );
 
-				$start_time 		= (int) $jobs[$jobid][start_timestamp];
+				$start_time 		= (int) $jobs[$jobid]['start_timestamp'];
 				$job_start 		= $start_time;
 
@@ -830,7 +830,7 @@
 				$view_jobs++;
 
-				if( $jobs[$jobid][status] == 'R' ) 
-				{
-					foreach( $jobs[$jobid][nodes] as $tempnode )
+				if( $jobs[$jobid]['status'] == 'R' ) 
+				{
+					foreach( $jobs[$jobid]['nodes'] as $tempnode )
 					{
 						$view_name_nodes[] 	= $tempnode;
@@ -843,9 +843,9 @@
 						$mynodehosts 		= array();
 
-						foreach( $jobs[$jobid][nodes] as $mynode ) 
+						foreach( $jobs[$jobid]['nodes'] as $mynode ) 
 						{
 							if( $use_fqdn == 1)
 							{
-								$mynode	= $mynode.".".$jobs[$jobid][domain];
+								$mynode	= $mynode.".".$jobs[$jobid]['domain'];
 							}
 							$myhost_href 	= "./?c=".$clustername."&h=".$mynode;
@@ -859,7 +859,7 @@
 					}
 				} 
-				else if( $jobs[$jobid][status] == 'Q' ) 
-				{
-					$view_nodes 	+= (int) $jobs[$jobid][nodes];
+				else if( $jobs[$jobid]['status'] == 'Q' ) 
+				{
+					$view_nodes 	+= (int) $jobs[$jobid]['nodes'];
 				}
 
@@ -951,5 +951,5 @@
 		if( $last_displayed_job != null )
 		{
-			$filter[id] = $last_displayed_job;
+			$filter['id'] = $last_displayed_job;
 		}
 	}
@@ -988,5 +988,5 @@
 
 		$tpl->assign( "metric","$metricname $units" );
-		$tpl->assign( "id", $filter[id] );
+		$tpl->assign( "id", $filter['id'] );
 
 		# Host columns menu defined in header.php
@@ -1009,5 +1009,5 @@
 
 			$sorted_hosts 	= array();
-			$hosts_up 	= $jobs[$filter[id]][nodes];
+			$hosts_up 	= $jobs[$filter['id']]['nodes'];
 
 			//printf( "r %s\n", $job_runningtime );
@@ -1051,5 +1051,5 @@
 				}
 
-				$load_one 		= $metrics[$host]["load_one"][VAL];
+				$load_one 		= $metrics[$host]["load_one"]['VAL'];
 				$load 			= ((float) $load_one) / $cpus;
 				$host_load[$host] 	= $load;
@@ -1063,5 +1063,5 @@
 				else
 				{
-					$sorted_hosts[$host] 	= $metrics[$host][$metricname][VAL];
+					$sorted_hosts[$host] 	= $metrics[$host][$metricname]['VAL'];
 				}
 			}
@@ -1119,5 +1119,5 @@
 					$load_color	= load_color($host_load[$host]);
 					$graphargs 	= ($reports[$metricname]) ? "g=$metricname&" : "m=$metricname&";
-					$graphargs 	.= "z=small&c=$cluster_url&h=$host_url&l=$load_color" . "&v=$val[VAL]&r=job&jr=$jobrange&js=$jobstart";
+					$graphargs 	.= "z=small&c=$cluster_url&h=$host_url&l=$load_color" . "&v=$val['VAL']&r=job&jr=$jobrange&js=$jobstart";
 					if( $max > 0 ) 
 					{
