Index: /branches/0.4/web/addons/job_monarch/graph.php
===================================================================
--- /branches/0.4/web/addons/job_monarch/graph.php	(revision 730)
+++ /branches/0.4/web/addons/job_monarch/graph.php	(revision 731)
@@ -36,13 +36,13 @@
 
 # Graph specific variables
-$size = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["z"] ));
-$graph = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["g"] ));
-$grid = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["G"] ));
-$self = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["me"] ));
-$max = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["x"] ));
-$min = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["n"] ));
-$value = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["v"] ));
-$load_color = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["l"] ));
-$vlabel = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["vl"] ));
+$size = escapeshellcmd( rawurldecode( $_GET["z"] ));
+$graph = escapeshellcmd( rawurldecode( $_GET["g"] ));
+$grid = escapeshellcmd( rawurldecode( $_GET["G"] ));
+$self = escapeshellcmd( rawurldecode( $_GET["me"] ));
+$max = escapeshellcmd( rawurldecode( $_GET["x"] ));
+$min = escapeshellcmd( rawurldecode( $_GET["n"] ));
+$value = escapeshellcmd( rawurldecode( $_GET["v"] ));
+$load_color = escapeshellcmd( rawurldecode( $_GET["l"] ));
+$vlabel = escapeshellcmd( rawurldecode( $_GET["vl"] ));
 
 $cluster = $c;
@@ -61,4 +61,9 @@
     $width = 300;
 } 
+else if ($size == "overview-medium") 
+{
+    $height = 75;
+    $width = 300;
+} 
 else 
 {
@@ -67,4 +72,6 @@
 }
 
+$jobstart_color = "FF0000";
+
 if($command) 
 {
@@ -75,4 +82,6 @@
 
 $graph = $metricname;
+
+$rrd_dirs = Array();
 
 if (isset($graph)) 
@@ -81,5 +90,12 @@
     if( isset( $period_start ) && isset( $period_stop ) )
     {
-        $rrd_dirs = $trd->getRrdDirs( $period_start, $period_stop );
+        if( $size == 'overview-medium' )
+        {
+            $rrd_dirs[] = $conf['rrds'] . '/' . $cluster .'/'. $hostname;
+        }
+        else
+        {
+            $rrd_dirs = $trd->getRrdDirs( $period_start, $period_stop );
+        }
     }
 
@@ -122,15 +138,15 @@
                 ."DEF:'cpu_system${def_nr}'='${rrd_dir}/cpu_system.rrd':'sum':AVERAGE "
                 ."DEF:'cpu_idle${def_nr}'='${rrd_dir}/cpu_idle.rrd':'sum':AVERAGE "
-                ."AREA:'cpu_user${def_nr}'#${cpu_user_color}${user_str} "
-                ."STACK:'cpu_nice${def_nr}'#${cpu_nice_color}${nice_str} "
-                ."STACK:'cpu_system${def_nr}'#${cpu_system_color}${system_str} ";
+                ."AREA:'cpu_user${def_nr}'#".$conf['cpu_user_color']."${user_str} "
+                ."STACK:'cpu_nice${def_nr}'#".$conf['cpu_nice_color']."${nice_str} "
+                ."STACK:'cpu_system${def_nr}'#".$conf['cpu_system_color']."${system_str} ";
 
             if (file_exists("$rrd_dir/cpu_wio.rrd")) 
             {
                 $series .= "DEF:'cpu_wio${def_nr}'='${rrd_dir}/cpu_wio.rrd':'sum':AVERAGE "
-                    ."STACK:'cpu_wio${def_nr}'#${cpu_wio_color}${wio_str} ";
-            }
-
-            $series .= "STACK:'cpu_idle${def_nr}'#${cpu_idle_color}${idle_str} ";
+                    ."STACK:'cpu_wio${def_nr}'#".$conf['cpu_wio_color']."${wio_str} ";
+            }
+
+            $series .= "STACK:'cpu_idle${def_nr}'#".$conf['cpu_idle_color']."${idle_str} ";
 
             $def_nr++;
@@ -222,8 +238,8 @@
                 ."CDEF:'bmem_buffers${def_nr}'=mem_buffers${def_nr},1024,* "
                 ."CDEF:'bmem_used${def_nr}'='bmem_total${def_nr}','bmem_shared${def_nr}',-,'bmem_free${def_nr}',-,'bmem_cached${def_nr}',-,'bmem_buffers${def_nr}',- "
-                ."AREA:'bmem_used${def_nr}'#${mem_used_color}${memuse_str} "
-                ."STACK:'bmem_shared${def_nr}'#${mem_shared_color}${memshared_str} "
-                ."STACK:'bmem_cached${def_nr}'#${mem_cached_color}${memcached_str} "
-                ."STACK:'bmem_buffers${def_nr}'#${mem_buffered_color}${membuff_str} ";
+                ."AREA:'bmem_used${def_nr}'#".$conf['mem_used_color']."${memuse_str} "
+                ."STACK:'bmem_shared${def_nr}'#".$conf['mem_shared_color']."${memshared_str} "
+                ."STACK:'bmem_cached${def_nr}'#".$conf['mem_cached_color']."${memcached_str} "
+                ."STACK:'bmem_buffers${def_nr}'#".$conf['mem_buffered_color']."${membuff_str} ";
 
             if (file_exists("$rrd_dir/swap_total.rrd")) 
@@ -232,8 +248,8 @@
                     ."DEF:'swap_free${def_nr}'='${rrd_dir}/swap_free.rrd':'sum':AVERAGE "
                     ."CDEF:'bmem_swapped${def_nr}'='swap_total${def_nr}','swap_free${def_nr}',-,1024,* "
-                    ."STACK:'bmem_swapped${def_nr}'#${mem_swapped_color}${memswap_str} ";
-            }
-
-            $series .= "LINE2:'bmem_total${def_nr}'#${cpu_num_color}${total_str} ";
+                    ."STACK:'bmem_swapped${def_nr}'#".$conf['mem_swapped_color']."${memswap_str} ";
+            }
+
+            $series .= "LINE2:'bmem_total${def_nr}'#".$conf['cpu_num_color']."${total_str} ";
 
             $def_nr++;
@@ -270,7 +286,7 @@
                 ."DEF:'proc_run${def_nr}'='${rrd_dir}/proc_run.rrd':'sum':AVERAGE "
                 ."DEF:'cpu_num${def_nr}'='${rrd_dir}/cpu_num.rrd':'sum':AVERAGE ";
-            $series .="AREA:'load_one${def_nr}'#${load_one_color}${load_str} ";
-            $series .="LINE2:'cpu_num${def_nr}'#${cpu_num_color}${cpu_str} ";
-            $series .="LINE2:'proc_run${def_nr}'#${proc_run_color}${run_str} ";
+            $series .="AREA:'load_one${def_nr}'#".$conf['load_one_color']."${load_str} ";
+            $series .="LINE2:'cpu_num${def_nr}'#".$conf['cpu_num_color']."${cpu_str} ";
+            $series .="LINE2:'proc_run${def_nr}'#".$conf['proc_run_color']."${run_str} ";
 
             $def_nr++;
@@ -306,6 +322,6 @@
             $series .= "DEF:'bytes_in${def_nr}'='${rrd_dir}/bytes_in.rrd':'sum':AVERAGE "
                 ."DEF:'bytes_out${def_nr}'='${rrd_dir}/bytes_out.rrd':'sum':AVERAGE "
-                ."LINE2:'bytes_in${def_nr}'#${mem_cached_color}${in_str} "
-                ."LINE2:'bytes_out${def_nr}'#${mem_used_color}${out_str} ";
+                ."LINE2:'bytes_in${def_nr}'#".$conf['mem_cached_color']."${in_str} "
+                ."LINE2:'bytes_out${def_nr}'#".$conf['mem_used_color']."${out_str} ";
 
             $def_nr++;
@@ -341,6 +357,6 @@
             $series .= "DEF:'bytes_in${def_nr}'='${rrd_dir}/pkts_in.rrd':'sum':AVERAGE "
                 ."DEF:'bytes_out${def_nr}'='${rrd_dir}/pkts_out.rrd':'sum':AVERAGE "
-                ."LINE2:'bytes_in${def_nr}'#${mem_cached_color}${in_str} "
-                ."LINE2:'bytes_out${def_nr}'#${mem_used_color}${out_str} ";
+                ."LINE2:'bytes_in${def_nr}'#".$conf['mem_cached_color']."${in_str} "
+                ."LINE2:'bytes_out${def_nr}'#".$conf['mem_used_color']."${out_str} ";
 
             $def_nr++;
@@ -400,5 +416,5 @@
             $rrd_file = "$rrd_dir/$metricname.rrd";
             $series .= "DEF:'sum${def_nr}'='$rrd_file':'sum':AVERAGE "
-                ."AREA:'sum${def_nr}'#${default_metric_color}${title_str} ";
+                ."AREA:'sum${def_nr}'#".$conf['default_metric_color']."${title_str} ";
 
             $def_nr++;
Index: /branches/0.4/web/addons/job_monarch/overview.php
===================================================================
--- /branches/0.4/web/addons/job_monarch/overview.php	(revision 730)
+++ /branches/0.4/web/addons/job_monarch/overview.php	(revision 731)
@@ -425,8 +425,8 @@
 
                 $ppn         = (int) $jobattrs['ppn'] ? $jobattrs['ppn'] : 1;
-                $cpus         = $nodes * $ppn;
-                $queued_time     = (int) $jobattrs['queued_timestamp'];
-                $start_time     = (int) $jobattrs['start_timestamp'];
-                $runningtime     = $report_time - $start_time;
+                $cpus        = $nodes * $ppn;
+                $queued_time = (int) $jobattrs['queued_timestamp'];
+                $start_time  = (int) $jobattrs['start_timestamp'];
+                $runningtime = $report_time - $start_time;
 
                 switch( $sortby ) 
@@ -508,4 +508,11 @@
 
     $metricname        = $m;
+    if( isset($conf['default_metric']) and ($metricname =='') )
+        $metricname = $conf['default_metric'];
+    else
+        if( isset( $m ) )
+            $metricname = $m;
+        else
+            $metricname = "load_one";
 
     $tpl->assign("sortorder", $sortorder );
@@ -985,8 +992,8 @@
             }
 
-            $sorted_hosts     = array();
+            $sorted_hosts = array();
             $hosts_up     = $jobs[$filter['id']]['nodes'];
 
-            $r         = intval($job_runningtime * 1.2);
+            $r            = intval($job_runningtime * 1.2);
 
             $jobrange     = -$r ;
@@ -1023,5 +1030,5 @@
                 $load_one         = $metrics[$host]["load_one"]['VAL'];
                 $load             = ((float) $load_one) / $cpus;
-                $host_load[$host]     = $load;
+                $host_load[$host] = $load;
 
                 $percent_hosts[load_color($load)] ++;
@@ -1068,12 +1075,12 @@
                 $tpl->newBlock( "sorted_list" );
 
-                $host_url     = rawurlencode( $host );
-                $cluster_url     = rawurlencode( $clustername );
+                $host_url    = rawurlencode( $host );
+                $cluster_url = rawurlencode( $clustername );
 
                 $textval     = "";
 
                 $val         = $metrics[$host][$metricname];
-                $class         = "metric";
-                $host_link    = "\"../../?c=$cluster_url&h=$host_url&r=job&jr=$jobrange&js=$jobstart\"";
+                $class       = "metric";
+                $host_link   = "\"../../?c=$cluster_url&h=$host_url&r=job&jr=$jobrange&js=$jobstart\"";
 
                 if ( $val["TYPE"] == "timestamp" || $always_timestamp[$metricname] ) 
@@ -1087,7 +1094,12 @@
                 else 
                 {
+                    $job_start     = $jobs[$last_displayed_job]['start_timestamp'];
+                    $period_end    = time();
+                    $runningtime   = time() - intval( $job_start );
                     $load_color    = load_color($host_load[$host]);
+                    $period_start  = intval( $job_start - (intval( $runningtime * 0.10 ) ) );
+                    //printf("last job %s job start %s runningtime %s period start %s", $last_displayed_job, $jobstart, $job_runningtime, $period_start);
                     $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=overview-medium&c=$cluster_url&h=$host_url&l=$load_color&v=".$val['VAL']."&job_start=$job_start&period_start=$period_start&period_stop=$period_end";
                     if( $max > 0 ) 
                     {
@@ -1099,5 +1111,5 @@
                     $cell    = "<td class=$class>".  "<b><a href=$host_link>$host</a></b><br>".  "<i>$metricname:</i> <b>$textval</b></td>";
                 } else {
-                    $cell    = "<td><a href=$host_link>" . "<img src=\"../../graph.php?$graphargs\" " . "alt=\"$host\" border=0></a></td>";
+                    $cell    = "<td><a href=$host_link>" . "<img src=\"./graph.php?$graphargs\" " . "alt=\"$host\" border=0></a></td>";
                 }
 
