Changeset 731


Ignore:
Timestamp:
03/24/13 02:07:26 (11 years ago)
Author:
ramonb
Message:

graph.php:

  • fixed GET variables
  • added overview graph size
  • set jobstart color
  • set rrd_dirs to current ganglia RRDs if overview-graph
  • fixed RRD colors to new Ganglia conf array

overview.php:

  • use our graph.php for RRDs
  • set job start and period start/end
Location:
branches/0.4/web/addons/job_monarch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/0.4/web/addons/job_monarch/graph.php

    r726 r731  
    3636
    3737# Graph specific variables
    38 $size = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["z"] ));
    39 $graph = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["g"] ));
    40 $grid = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["G"] ));
    41 $self = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["me"] ));
    42 $max = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["x"] ));
    43 $min = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["n"] ));
    44 $value = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["v"] ));
    45 $load_color = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["l"] ));
    46 $vlabel = escapeshellcmd( rawurldecode( $HTTP_GET_VARS["vl"] ));
     38$size = escapeshellcmd( rawurldecode( $_GET["z"] ));
     39$graph = escapeshellcmd( rawurldecode( $_GET["g"] ));
     40$grid = escapeshellcmd( rawurldecode( $_GET["G"] ));
     41$self = escapeshellcmd( rawurldecode( $_GET["me"] ));
     42$max = escapeshellcmd( rawurldecode( $_GET["x"] ));
     43$min = escapeshellcmd( rawurldecode( $_GET["n"] ));
     44$value = escapeshellcmd( rawurldecode( $_GET["v"] ));
     45$load_color = escapeshellcmd( rawurldecode( $_GET["l"] ));
     46$vlabel = escapeshellcmd( rawurldecode( $_GET["vl"] ));
    4747
    4848$cluster = $c;
     
    6161    $width = 300;
    6262}
     63else if ($size == "overview-medium")
     64{
     65    $height = 75;
     66    $width = 300;
     67}
    6368else
    6469{
     
    6772}
    6873
     74$jobstart_color = "FF0000";
     75
    6976if($command)
    7077{
     
    7582
    7683$graph = $metricname;
     84
     85$rrd_dirs = Array();
    7786
    7887if (isset($graph))
     
    8190    if( isset( $period_start ) && isset( $period_stop ) )
    8291    {
    83         $rrd_dirs = $trd->getRrdDirs( $period_start, $period_stop );
     92        if( $size == 'overview-medium' )
     93        {
     94            $rrd_dirs[] = $conf['rrds'] . '/' . $cluster .'/'. $hostname;
     95        }
     96        else
     97        {
     98            $rrd_dirs = $trd->getRrdDirs( $period_start, $period_stop );
     99        }
    84100    }
    85101
     
    122138                ."DEF:'cpu_system${def_nr}'='${rrd_dir}/cpu_system.rrd':'sum':AVERAGE "
    123139                ."DEF:'cpu_idle${def_nr}'='${rrd_dir}/cpu_idle.rrd':'sum':AVERAGE "
    124                 ."AREA:'cpu_user${def_nr}'#${cpu_user_color}${user_str} "
    125                 ."STACK:'cpu_nice${def_nr}'#${cpu_nice_color}${nice_str} "
    126                 ."STACK:'cpu_system${def_nr}'#${cpu_system_color}${system_str} ";
     140                ."AREA:'cpu_user${def_nr}'#".$conf['cpu_user_color']."${user_str} "
     141                ."STACK:'cpu_nice${def_nr}'#".$conf['cpu_nice_color']."${nice_str} "
     142                ."STACK:'cpu_system${def_nr}'#".$conf['cpu_system_color']."${system_str} ";
    127143
    128144            if (file_exists("$rrd_dir/cpu_wio.rrd"))
    129145            {
    130146                $series .= "DEF:'cpu_wio${def_nr}'='${rrd_dir}/cpu_wio.rrd':'sum':AVERAGE "
    131                     ."STACK:'cpu_wio${def_nr}'#${cpu_wio_color}${wio_str} ";
    132             }
    133 
    134             $series .= "STACK:'cpu_idle${def_nr}'#${cpu_idle_color}${idle_str} ";
     147                    ."STACK:'cpu_wio${def_nr}'#".$conf['cpu_wio_color']."${wio_str} ";
     148            }
     149
     150            $series .= "STACK:'cpu_idle${def_nr}'#".$conf['cpu_idle_color']."${idle_str} ";
    135151
    136152            $def_nr++;
     
    222238                ."CDEF:'bmem_buffers${def_nr}'=mem_buffers${def_nr},1024,* "
    223239                ."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}',- "
    224                 ."AREA:'bmem_used${def_nr}'#${mem_used_color}${memuse_str} "
    225                 ."STACK:'bmem_shared${def_nr}'#${mem_shared_color}${memshared_str} "
    226                 ."STACK:'bmem_cached${def_nr}'#${mem_cached_color}${memcached_str} "
    227                 ."STACK:'bmem_buffers${def_nr}'#${mem_buffered_color}${membuff_str} ";
     240                ."AREA:'bmem_used${def_nr}'#".$conf['mem_used_color']."${memuse_str} "
     241                ."STACK:'bmem_shared${def_nr}'#".$conf['mem_shared_color']."${memshared_str} "
     242                ."STACK:'bmem_cached${def_nr}'#".$conf['mem_cached_color']."${memcached_str} "
     243                ."STACK:'bmem_buffers${def_nr}'#".$conf['mem_buffered_color']."${membuff_str} ";
    228244
    229245            if (file_exists("$rrd_dir/swap_total.rrd"))
     
    232248                    ."DEF:'swap_free${def_nr}'='${rrd_dir}/swap_free.rrd':'sum':AVERAGE "
    233249                    ."CDEF:'bmem_swapped${def_nr}'='swap_total${def_nr}','swap_free${def_nr}',-,1024,* "
    234                     ."STACK:'bmem_swapped${def_nr}'#${mem_swapped_color}${memswap_str} ";
    235             }
    236 
    237             $series .= "LINE2:'bmem_total${def_nr}'#${cpu_num_color}${total_str} ";
     250                    ."STACK:'bmem_swapped${def_nr}'#".$conf['mem_swapped_color']."${memswap_str} ";
     251            }
     252
     253            $series .= "LINE2:'bmem_total${def_nr}'#".$conf['cpu_num_color']."${total_str} ";
    238254
    239255            $def_nr++;
     
    270286                ."DEF:'proc_run${def_nr}'='${rrd_dir}/proc_run.rrd':'sum':AVERAGE "
    271287                ."DEF:'cpu_num${def_nr}'='${rrd_dir}/cpu_num.rrd':'sum':AVERAGE ";
    272             $series .="AREA:'load_one${def_nr}'#${load_one_color}${load_str} ";
    273             $series .="LINE2:'cpu_num${def_nr}'#${cpu_num_color}${cpu_str} ";
    274             $series .="LINE2:'proc_run${def_nr}'#${proc_run_color}${run_str} ";
     288            $series .="AREA:'load_one${def_nr}'#".$conf['load_one_color']."${load_str} ";
     289            $series .="LINE2:'cpu_num${def_nr}'#".$conf['cpu_num_color']."${cpu_str} ";
     290            $series .="LINE2:'proc_run${def_nr}'#".$conf['proc_run_color']."${run_str} ";
    275291
    276292            $def_nr++;
     
    306322            $series .= "DEF:'bytes_in${def_nr}'='${rrd_dir}/bytes_in.rrd':'sum':AVERAGE "
    307323                ."DEF:'bytes_out${def_nr}'='${rrd_dir}/bytes_out.rrd':'sum':AVERAGE "
    308                 ."LINE2:'bytes_in${def_nr}'#${mem_cached_color}${in_str} "
    309                 ."LINE2:'bytes_out${def_nr}'#${mem_used_color}${out_str} ";
     324                ."LINE2:'bytes_in${def_nr}'#".$conf['mem_cached_color']."${in_str} "
     325                ."LINE2:'bytes_out${def_nr}'#".$conf['mem_used_color']."${out_str} ";
    310326
    311327            $def_nr++;
     
    341357            $series .= "DEF:'bytes_in${def_nr}'='${rrd_dir}/pkts_in.rrd':'sum':AVERAGE "
    342358                ."DEF:'bytes_out${def_nr}'='${rrd_dir}/pkts_out.rrd':'sum':AVERAGE "
    343                 ."LINE2:'bytes_in${def_nr}'#${mem_cached_color}${in_str} "
    344                 ."LINE2:'bytes_out${def_nr}'#${mem_used_color}${out_str} ";
     359                ."LINE2:'bytes_in${def_nr}'#".$conf['mem_cached_color']."${in_str} "
     360                ."LINE2:'bytes_out${def_nr}'#".$conf['mem_used_color']."${out_str} ";
    345361
    346362            $def_nr++;
     
    400416            $rrd_file = "$rrd_dir/$metricname.rrd";
    401417            $series .= "DEF:'sum${def_nr}'='$rrd_file':'sum':AVERAGE "
    402                 ."AREA:'sum${def_nr}'#${default_metric_color}${title_str} ";
     418                ."AREA:'sum${def_nr}'#".$conf['default_metric_color']."${title_str} ";
    403419
    404420            $def_nr++;
  • branches/0.4/web/addons/job_monarch/overview.php

    r730 r731  
    425425
    426426                $ppn         = (int) $jobattrs['ppn'] ? $jobattrs['ppn'] : 1;
    427                 $cpus         = $nodes * $ppn;
    428                 $queued_time     = (int) $jobattrs['queued_timestamp'];
    429                 $start_time     = (int) $jobattrs['start_timestamp'];
    430                 $runningtime     = $report_time - $start_time;
     427                $cpus        = $nodes * $ppn;
     428                $queued_time = (int) $jobattrs['queued_timestamp'];
     429                $start_time  = (int) $jobattrs['start_timestamp'];
     430                $runningtime = $report_time - $start_time;
    431431
    432432                switch( $sortby )
     
    508508
    509509    $metricname        = $m;
     510    if( isset($conf['default_metric']) and ($metricname =='') )
     511        $metricname = $conf['default_metric'];
     512    else
     513        if( isset( $m ) )
     514            $metricname = $m;
     515        else
     516            $metricname = "load_one";
    510517
    511518    $tpl->assign("sortorder", $sortorder );
     
    985992            }
    986993
    987             $sorted_hosts     = array();
     994            $sorted_hosts = array();
    988995            $hosts_up     = $jobs[$filter['id']]['nodes'];
    989996
    990             $r         = intval($job_runningtime * 1.2);
     997            $r            = intval($job_runningtime * 1.2);
    991998
    992999            $jobrange     = -$r ;
     
    10231030                $load_one         = $metrics[$host]["load_one"]['VAL'];
    10241031                $load             = ((float) $load_one) / $cpus;
    1025                 $host_load[$host]     = $load;
     1032                $host_load[$host] = $load;
    10261033
    10271034                $percent_hosts[load_color($load)] ++;
     
    10681075                $tpl->newBlock( "sorted_list" );
    10691076
    1070                 $host_url     = rawurlencode( $host );
    1071                 $cluster_url     = rawurlencode( $clustername );
     1077                $host_url    = rawurlencode( $host );
     1078                $cluster_url = rawurlencode( $clustername );
    10721079
    10731080                $textval     = "";
    10741081
    10751082                $val         = $metrics[$host][$metricname];
    1076                 $class         = "metric";
    1077                 $host_link    = "\"../../?c=$cluster_url&h=$host_url&r=job&jr=$jobrange&js=$jobstart\"";
     1083                $class       = "metric";
     1084                $host_link   = "\"../../?c=$cluster_url&h=$host_url&r=job&jr=$jobrange&js=$jobstart\"";
    10781085
    10791086                if ( $val["TYPE"] == "timestamp" || $always_timestamp[$metricname] )
     
    10871094                else
    10881095                {
     1096                    $job_start     = $jobs[$last_displayed_job]['start_timestamp'];
     1097                    $period_end    = time();
     1098                    $runningtime   = time() - intval( $job_start );
    10891099                    $load_color    = load_color($host_load[$host]);
     1100                    $period_start  = intval( $job_start - (intval( $runningtime * 0.10 ) ) );
     1101                    //printf("last job %s job start %s runningtime %s period start %s", $last_displayed_job, $jobstart, $job_runningtime, $period_start);
    10901102                    $graphargs     = ($reports[$metricname]) ? "g=$metricname&" : "m=$metricname&";
    1091                     $graphargs     .= "z=small&c=$cluster_url&h=$host_url&l=$load_color&v=".$val['VAL']."&r=job&jr=$jobrange&js=$jobstart";
     1103                    $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";
    10921104                    if( $max > 0 )
    10931105                    {
     
    10991111                    $cell    = "<td class=$class>".  "<b><a href=$host_link>$host</a></b><br>".  "<i>$metricname:</i> <b>$textval</b></td>";
    11001112                } else {
    1101                     $cell    = "<td><a href=$host_link>" . "<img src=\"../../graph.php?$graphargs\" " . "alt=\"$host\" border=0></a></td>";
     1113                    $cell    = "<td><a href=$host_link>" . "<img src=\"./graph.php?$graphargs\" " . "alt=\"$host\" border=0></a></td>";
    11021114                }
    11031115
Note: See TracChangeset for help on using the changeset viewer.