Changeset 762 for branches/0.4/web/addons/job_monarch
- Timestamp:
- 03/27/13 21:27:01 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/web/addons/job_monarch/host_view.php
r759 r762 25 25 include_once "./libtoga.php"; 26 26 27 $my_dir = getcwd();28 29 global $context;30 31 $context = 'cluster';32 33 27 if( $view == "overview-host" ) 34 28 { 29 $my_dir = getcwd(); 30 31 global $context; 32 33 $context = 'cluster'; 34 35 35 chdir( $GANGLIA_PATH ); 36 36 … … 107 107 { 108 108 $mymetrics = $metrics; 109 unset( $mymetrics['last_reported_timestamp'] ); // Ganglia bug? 109 110 #print_r( $mymetrics ); 110 111 } … … 170 171 $tpl_data->assign("node_view","./?p=2&c=$cluster_url&h=$hostname"); 171 172 172 $tpl_data->assign("ip", $hosts_up[ IP]);173 $tpl_data->assign("ip", $hosts_up['IP']); 173 174 174 175 #print_r( $mymetrics ); … … 176 177 foreach ($mymetrics as $name => $v) 177 178 { 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') 179 180 { 180 181 # 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]) 184 185 { 185 186 $c_metrics[$name] = $v; … … 203 204 } 204 205 # 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']); 208 209 $graphargs .= "&vl=$encodeUnits"; 209 210 } 210 $g_metrics[$name][ graph] = $graphargs;211 $g_metrics[$name]['graph'] = $graphargs; 211 212 } 212 213 } 213 214 # Add the uptime metric for this host. Cannot be done in ganglia.php, 214 215 # 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']); 217 218 218 219 # Add the gmond started timestamps & last reported time (in uptime format) from 219 220 # 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']); 224 225 225 226 # Show string metrics … … 232 233 $metric_info = array(); 233 234 $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']); 237 238 } 238 239 else 239 240 { 240 $metric_info["value"] = "$v[VAL] $v[UNITS]";241 $metric_info["value"] = $v['VAL']." ". $v['UNITS']; 241 242 } 242 243 $string_metric_info_loop[] = $metric_info; … … 254 255 $const_info = array(); 255 256 $const_infp["name"] = $name; 256 $const_info["value"] = "$v[VAL] $v[UNITS]";257 $const_info["value"] = $v[VAL]." ". $v[UNITS]; 257 258 $const_metric_info_loop[] = $const_info; 258 259 } … … 270 271 { 271 272 $metric_info = array(); 272 $metric_info["graphargs"] = $v[ graph];273 $metric_info["graphargs"] = $v['graph']; 273 274 $metric_info["alt"] = "$hostname $name"; 274 275 $vol_metric_info_loop[] = $metric_info;
Note: See TracChangeset
for help on using the changeset viewer.