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
File:
1 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++;
Note: See TracChangeset for help on using the changeset viewer.