Changeset 762


Ignore:
Timestamp:
03/27/13 21:27:01 (8 years ago)
Author:
ramonb
Message:
  • cleanup
File:
1 edited

Legend:

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

    r759 r762  
    2525include_once "./libtoga.php";
    2626
    27 $my_dir = getcwd();
    28 
    29 global $context;
    30 
    31 $context = 'cluster';
    32 
    3327if( $view == "overview-host" )
    3428{
     29    $my_dir = getcwd();
     30
     31    global $context;
     32
     33    $context = 'cluster';
     34
    3535    chdir( $GANGLIA_PATH );
    3636
     
    107107        {
    108108            $mymetrics = $metrics;
     109            unset( $mymetrics['last_reported_timestamp'] ); // Ganglia bug?
    109110            #print_r( $mymetrics );
    110111        }
     
    170171    $tpl_data->assign("node_view","./?p=2&c=$cluster_url&h=$hostname");
    171172
    172     $tpl_data->assign("ip", $hosts_up[IP]);
     173    $tpl_data->assign("ip", $hosts_up['IP']);
    173174
    174175    #print_r( $mymetrics );
     
    176177    foreach ($mymetrics as $name => $v)
    177178    {
    178         if ($v[TYPE] == "string" or $v[TYPE]=="timestamp" or $always_timestamp[$name])
     179        if ($v['TYPE'] == "string" or $v['TYPE']=="timestamp" or $always_timestamp[$name] or $v['NAME']=='last_reported_timestamp')
    179180        {
    180181            # Long gmetric name/values will disrupt the display here.
    181             if ($v[SOURCE] == "gmond") $s_metrics[$name] = $v;
    182         }
    183         else if ($v[SLOPE] == "zero" or $always_constant[$name])
     182            if ($v['SOURCE'] == "gmond") $s_metrics[$name] = $v;
     183        }
     184        else if ($v['SLOPE'] == "zero" or $always_constant[$name])
    184185        {
    185186            $c_metrics[$name] = $v;
     
    203204            }
    204205            # Adding units to graph 2003 by Jason Smith <smithj4@bnl.gov>.
    205             if ($v[UNITS])
    206             {
    207                 $encodeUnits = rawurlencode($v[UNITS]);
     206            if ($v['UNITS'])
     207            {
     208                $encodeUnits = rawurlencode($v['UNITS']);
    208209                $graphargs .= "&vl=$encodeUnits";
    209210            }
    210             $g_metrics[$name][graph] = $graphargs;
     211            $g_metrics[$name]['graph'] = $graphargs;
    211212        }
    212213    }
    213214    # Add the uptime metric for this host. Cannot be done in ganglia.php,
    214215    # since it requires a fully-parsed XML tree. The classic contructor problem.
    215     $s_metrics[uptime][TYPE] = "string";
    216     $s_metrics[uptime][VAL] = uptime($cluster[LOCALTIME] - $metrics[boottime][VAL]);
     216    $s_metrics['uptime']['TYPE'] = "string";
     217    $s_metrics['uptime']['VAL'] = uptime($cluster['LOCALTIME'] - $metrics['boottime']['VAL']);
    217218
    218219    # Add the gmond started timestamps & last reported time (in uptime format) from
    219220    # the HOST tag:
    220     $s_metrics[gmond_started][TYPE] = "timestamp";
    221     $s_metrics[gmond_started][VAL] = $hosts_up[GMOND_STARTED];
    222     $s_metrics[last_reported][TYPE] = "string";
    223     $s_metrics[last_reported][VAL] = uptime($cluster[LOCALTIME] - $hosts_up[REPORTED]);
     221    $s_metrics['gmond_started']['TYPE'] = "timestamp";
     222    $s_metrics['gmond_started']['VAL'] = $hosts_up['GMOND_STARTED'];
     223    $s_metrics['last_reported']['TYPE'] = "string";
     224    $s_metrics['last_reported']['VAL'] = uptime($cluster['LOCALTIME'] - $hosts_up['REPORTED']);
    224225
    225226    # Show string metrics
     
    232233            $metric_info = array();
    233234            $metric_info["name"] = $name;
    234             if( $v[TYPE]=="timestamp" or $always_timestamp[$name])
    235             {
    236                 $metric_info["value"] = date("r", $v[VAL]);
     235            if( $v['TYPE']=="timestamp" or $always_timestamp[$name])
     236            {
     237                $metric_info["value"] = date("r", $v['VAL']);
    237238            }
    238239            else
    239240            {
    240                 $metric_info["value"] = "$v[VAL] $v[UNITS]";
     241                $metric_info["value"] = $v['VAL']." ". $v['UNITS'];
    241242            }
    242243            $string_metric_info_loop[] = $metric_info;
     
    254255            $const_info = array();
    255256            $const_infp["name"] = $name;
    256             $const_info["value"] = "$v[VAL] $v[UNITS]";
     257            $const_info["value"] = $v[VAL]." ". $v[UNITS];
    257258            $const_metric_info_loop[] = $const_info;
    258259        }
     
    270271        {
    271272            $metric_info = array();
    272             $metric_info["graphargs"] = $v[graph];
     273            $metric_info["graphargs"] = $v['graph'];
    273274            $metric_info["alt"] = "$hostname $name";
    274275            $vol_metric_info_loop[] = $metric_info;
Note: See TracChangeset for help on using the changeset viewer.