Ignore:
Timestamp:
03/27/13 20:50:05 (11 years ago)
Author:
ramonb
Message:

host_view.php,
templates/host_view.tpl:

graph.php:

  • set range as title if it's not job

libtoga.php:

  • remove some timestamp from metrics
Location:
branches/0.4/web/addons/job_monarch
Files:
4 edited

Legend:

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

    r758 r759  
    441441}
    442442
    443 if ($graph == "job_report")
    444 {
    445     $title = "Last: $j_title";
     443if($graph == "job_report")
     444{
     445    if($range == 'job' )
     446    {
     447        $title = "Last: $j_title";
     448    }
     449    else
     450    {
     451        $title = "Last: $range";
     452    }
    446453}
    447454else
  • branches/0.4/web/addons/job_monarch/host_view.php

    r751 r759  
    3131$context = 'cluster';
    3232
    33 chdir( $GANGLIA_PATH );
    34 
    35 include "./ganglia.php";
    36 include "./get_ganglia.php";
    37 
    38 chdir( $my_dir );
     33if( $view == "overview-host" )
     34{
     35    chdir( $GANGLIA_PATH );
     36
     37    include "./ganglia.php";
     38    include "./get_ganglia.php";
     39
     40    chdir( $my_dir );
     41}
    3942
    4043function datetimeToEpoch( $datetime )
     
    6871{
    6972
    70     global $tpl, $metrics, $clustername, $hostname;
     73    global $dwoo, $metrics, $clustername, $hostname;
    7174    global $cluster_ul, $hosts_up, $get_metric_string;
    7275    global $cluster, $period_start, $period_stop;
    7376    global $job_start, $job_stop, $view, $conf, $range;
     77
     78    $tpl = new Dwoo_Template_File("templates/host_view.tpl");
     79    $tpl_data = new Dwoo_Data();
    7480
    7581    $rrdirs = array();
     
    124130    $hosts_up = $hosts_up[$hostname];
    125131
    126     $tpl->assign("cluster", $clustername);
    127     $tpl->assign("host", $hostname);
    128     $tpl->assign("node_image", "../../".node_image($metrics));
    129     $tpl->assign("sort",$sort);
    130     $tpl->assign("range",$range);
     132    $tpl_data->assign("cluster", $clustername);
     133    $tpl_data->assign("host", $hostname);
     134    $tpl_data->assign("node_image", "../../".node_image($metrics));
     135    $tpl_data->assign("sort",$sort);
     136    $tpl_data->assign("range",$range);
    131137
    132138    if( !is_numeric( $period_start ) )
     
    140146
    141147    if($hosts_up)
    142           $tpl->assign("node_msg", "This host is up and running.");
     148          $tpl_data->assign("node_msg", "This host is up and running.");
    143149    else
    144           $tpl->assign("node_msg", "This host is down.");
     150          $tpl_data->assign("node_msg", "This host is down.");
    145151
    146152    $cluster_url=rawurlencode($clustername);
    147     $tpl->assign("cluster_url", $cluster_url);
     153    $tpl_data->assign("cluster_url", $cluster_url);
    148154
    149155    $graphargs = "h=$hostname&r=$range&job_start=$job_start&job_stop=$job_stop";
     
    159165    }
    160166
    161     $tpl->assign("graphargs", "$graphargs");
     167    $tpl_data->assign("graphargs", "$graphargs");
    162168
    163169    # For the node view link.
    164     $tpl->assign("node_view","./?p=2&c=$cluster_url&h=$hostname");
    165 
    166     $tpl->assign("ip", $hosts_up[IP]);
     170    $tpl_data->assign("node_view","./?p=2&c=$cluster_url&h=$hostname");
     171
     172    $tpl_data->assign("ip", $hosts_up[IP]);
    167173
    168174    #print_r( $mymetrics );
     
    221227    {
    222228        ksort($s_metrics);
     229        $string_metric_info_loop = array();
    223230        foreach ($s_metrics as $name => $v )
    224231        {
    225             $tpl->newBlock("string_metric_info");
    226             $tpl->assign("name", $name);
     232            $metric_info = array();
     233            $metric_info["name"] = $name;
    227234            if( $v[TYPE]=="timestamp" or $always_timestamp[$name])
    228235            {
    229                 $tpl->assign("value", date("r", $v[VAL]));
     236                $metric_info["value"] = date("r", $v[VAL]);
    230237            }
    231238            else
    232239            {
    233                 $tpl->assign("value", "$v[VAL] $v[UNITS]");
    234             }
    235         }
     240                $metric_info["value"] = "$v[VAL] $v[UNITS]";
     241            }
     242            $string_metric_info_loop[] = $metric_info;
     243        }
     244        $tpl_data->assign("string_metric_info", $string_metric_info_loop );
    236245    }
    237246
     
    240249    {
    241250        ksort($c_metrics);
     251        $const_metric_info_loop = array();
    242252        foreach ($c_metrics as $name => $v )
    243253        {
    244             $tpl->newBlock("const_metric_info");
    245             $tpl->assign("name", $name);
    246             $tpl->assign("value", "$v[VAL] $v[UNITS]");
    247         }
     254            $const_info = array();
     255            $const_infp["name"] = $name;
     256            $const_info["value"] = "$v[VAL] $v[UNITS]";
     257            $const_metric_info_loop[] = $const_info;
     258        }
     259        $tpl_data->assign("const_metric_info", $const_metric_info_loop );
    248260    }
    249261
     
    252264    {
    253265        ksort($g_metrics);
     266        $vol_metric_info_loop = array();
    254267
    255268        $i = 0;
    256269        foreach ( $g_metrics as $name => $v )
    257270        {
    258             $tpl->newBlock("vol_metric_info");
    259             $tpl->assign("graphargs", $v[graph]);
    260             $tpl->assign("alt", "$hostname $name");
    261             if($i++ %2)
    262             {
    263                 $tpl->assign("br", "<BR>");
    264             }
    265          }
    266     }
     271            $metric_info = array();
     272            $metric_info["graphargs"] = $v[graph];
     273            $metric_info["alt"] = "$hostname $name";
     274            $vol_metric_info_loop[] = $metric_info;
     275        }
     276        $tpl_data->assign("vol_metric_info", $vol_metric_info_loop );
     277    }
     278    $dwoo->output($tpl, $tpl_data);
    267279}
    268280
  • branches/0.4/web/addons/job_monarch/libtoga.php

    r752 r759  
    751751            $metrics[$hostname]['last_reported']['VAL'] = $attrs['REPORTED'];
    752752            $metrics[$hostname]['last_reported']['TYPE'] = "string";
    753             $metrics[$hostname]['last_reported_timestamp']['NAME'] = "REPORTED TIMESTAMP";
    754             $metrics[$hostname]['last_reported_timestamp']['VAL'] = $attrs['REPORTED'];
    755             $metrics[$hostname]['last_reported_timestamp']['TYPE'] = "uint32";
    756753            $metrics[$hostname]['ip_address']['NAME'] = "IP";
    757754            $metrics[$hostname]['ip_address']['VAL'] = $attrs['IP'];
  • branches/0.4/web/addons/job_monarch/templates/host_view.tpl

    r737 r759  
    22<TR>
    33  <TD COLSPAN="2" BGCOLOR="#EEEEEE" ALIGN="CENTER">
    4   <FONT SIZE="+2">{host} Overview</FONT>
     4  <FONT SIZE="+2">{$host} Overview</FONT>
    55  </TD>
    66</TR>
     
    99 <TD ALIGN="LEFT" VALIGN="TOP">
    1010
    11 <IMG SRC="{node_image}" HEIGHT="60" WIDTH="30" ALT="{host}" BORDER="0">
    12 {node_msg}
     11<IMG SRC="{$node_image}" HEIGHT="60" WIDTH="30" ALT="{$host}" BORDER="0">
     12{$node_msg}
    1313<P>
    1414
     
    1818</TR>
    1919
    20 <!-- START BLOCK : string_metric_info -->
     20{loop $string_metric_info}
    2121<TR>
    22  <TD CLASS=footer WIDTH=30%>{name}</TD><TD>{value}</TD>
     22 <TD CLASS=footer WIDTH=30%>{$name}</TD><TD>{$value}</TD>
    2323</TR>
    24 <!-- END BLOCK : string_metric_info -->
     24{/loop}
    2525
    2626<TR><TD>&nbsp;</TD></TR>
     
    3030</TR>
    3131
    32 <!-- START BLOCK : const_metric_info -->
     32{loop $const_metric_info}
    3333<TR>
    34  <TD CLASS=footer WIDTH=30%>{name}</TD><TD>{value}</TD>
     34 <TD CLASS=footer WIDTH=30%>{$name}</TD><TD>{$value}</TD>
    3535</TR>
    36 <!-- END BLOCK : const_metric_info -->
     36{/loop}
    3737
    3838<TR><TD>&nbsp;</TD></TR>
     
    4040<TR>
    4141 <TD COLSPAN=2 CLASS=title>
    42  <a href="../../host_gmetrics.php?c={cluster_url}&h={host}">Gmetrics</a>
     42 <a href="../../host_gmetrics.php?c={$cluster_url}&h={$host}">Gmetrics</a>
    4343 </TD>
    4444</TR>
    4545</TABLE>
    4646
    47 <a href="./?c={cluster}&h={host}">
    48 <IMG SRC="./image.php?c={cluster}&h={host}&j_view=hostimage" BORDER=0>
     47<a href="./?c={$cluster}&h={$host}">
     48<IMG SRC="./image.php?c={$cluster}&h={$host}&j_view=hostimage" BORDER=0>
    4949</a>
    5050<hr>
     
    5353
    5454<TD ALIGN="CENTER" VALIGN="TOP" WIDTH="395">
    55 <IMG ALT="{cluster_url} LOAD"
    56    SRC="./graph.php?g=load_report&z=overview-medium&c={cluster_url}&{graphargs}">
    57 <IMG ALT="{cluster_url} MEM"
    58    SRC="./graph.php?g=mem_report&z=overview-medium&c={cluster_url}&{graphargs}">
    59 <IMG ALT="{cluster_url} CPU"
    60    SRC="./graph.php?g=cpu_report&z=overview-medium&c={cluster_url}&{graphargs}">
    61 <IMG ALT="{cluster_url} NETWORK"
    62    SRC="./graph.php?g=network_report&z=overview-medium&c={cluster_url}&{graphargs}">
    63 <IMG ALT="{cluster_url} PACKETS"
    64    SRC="./graph.php?g=packet_report&z=overview-medium&c={cluster_url}&{graphargs}">
    65 
     55<div id="monarchimage">
     56<IMG ALT="{$cluster_url} LOAD" SRC="./graph.php?g=load_report&z=overview-medium&c={$cluster_url}&{$graphargs}" WIDTH=381 HEIGHT=148>
     57<IMG ALT="{$cluster_url} MEM" SRC="./graph.php?g=mem_report&z=overview-medium&c={$cluster_url}&{$graphargs}" WIDTH=381 HEIGHT=148>
     58<IMG ALT="{$cluster_url} CPU" SRC="./graph.php?g=cpu_report&z=overview-medium&c={$cluster_url}&{$graphargs}" WIDTH=381 HEIGHT=148>
     59<IMG ALT="{$cluster_url} NETWORK" SRC="./graph.php?g=network_report&z=overview-medium&c={$cluster_url}&{$graphargs}" WIDTH=381 HEIGHT=148>
     60<IMG ALT="{$cluster_url} PACKETS" SRC="./graph.php?g=packet_report&z=overview-medium&c={$cluster_url}&{$graphargs}" WIDTH=381 HEIGHT=148>
     61</div>
    6662</TD>
    6763</TR>
     
    7268<TR>
    7369  <TD CLASS=title>
    74   {host} <strong>graphs</strong>
    75   last <strong>{range}</strong>
    76   sorted <strong>{sort}</strong>
     70  {$host} <strong>graphs</strong>
     71  last <strong>{$range}</strong>
     72  sorted <strong>{$sort}</strong>
    7773  </TD>
    7874</TR>
     
    8480 <TD>
    8581
    86 <!-- START BLOCK : vol_metric_info -->
    87 <IMG ALT="{alt}" SRC="./graph.php?{graphargs}">{br}
    88 <!-- END BLOCK : vol_metric_info -->
     82<div id="monarchimage">
     83{loop $vol_metric_info}
     84<IMG ALT="{$alt}" SRC="./graph.php?{$graphargs}" WIDTH=381 HEIGHT=148>
     85{/loop}
     86</div>
    8987
    9088 </TD>
Note: See TracChangeset for help on using the changeset viewer.