[113] | 1 | <?php |
---|
[225] | 2 | /* |
---|
| 3 | * |
---|
| 4 | * This file is part of Jobmonarch |
---|
| 5 | * |
---|
[732] | 6 | * Copyright (C) 2006-2013 Ramon Bastiaans |
---|
[225] | 7 | * |
---|
| 8 | * Jobmonarch is free software; you can redistribute it and/or modify |
---|
| 9 | * it under the terms of the GNU General Public License as published by |
---|
| 10 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 11 | * (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * Jobmonarch is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 21 | * |
---|
[231] | 22 | * SVN $Id: overview.php 836 2013-04-24 13:50:30Z ramonb $ |
---|
[225] | 23 | */ |
---|
| 24 | |
---|
[753] | 25 | global $GANGLIA_PATH, $clustername, $tpl_data, $filter, $cluster, $get_metric_string, $cluster_url, $sh; |
---|
[299] | 26 | global $hosts_up, $m, $start, $end, $filterorder, $COLUMN_REQUESTED_MEMORY, $COLUMN_QUEUED, $COLUMN_NODES, $hostname, $piefilter; |
---|
[409] | 27 | global $longtitle, $title, $range; |
---|
[114] | 28 | |
---|
[753] | 29 | include_once "./dwoo/dwooAutoload.php"; |
---|
[116] | 30 | |
---|
[753] | 31 | global $dwoo; |
---|
| 32 | |
---|
| 33 | $tpl = new Dwoo_Template_File("templates/overview.tpl"); |
---|
[822] | 34 | $tpl_data = array(); |
---|
[753] | 35 | |
---|
[822] | 36 | $tpl_data[ "clustername"]= $clustername ; |
---|
[753] | 37 | |
---|
[206] | 38 | if( $JOB_ARCHIVE ) |
---|
[328] | 39 | { |
---|
[822] | 40 | $tpl_data[ "cluster_url"]= rawurlencode($clustername) ; |
---|
[328] | 41 | } |
---|
[129] | 42 | |
---|
[738] | 43 | $rjqj_start = null; |
---|
[732] | 44 | $ds = new DataSource(); |
---|
| 45 | $myxml_data = $ds->getData(); |
---|
[328] | 46 | |
---|
[764] | 47 | //print_r( $myxml_data ); |
---|
| 48 | |
---|
[732] | 49 | $data_gatherer = new DataGatherer( $clustername ); |
---|
[326] | 50 | $data_gatherer->parseXML( $myxml_data ); |
---|
[117] | 51 | |
---|
[836] | 52 | $parsetime = $data_gatherer->parsetime; |
---|
[732] | 53 | $heartbeat = $data_gatherer->getHeartbeat(); |
---|
| 54 | $jobs = $data_gatherer->getJobs(); |
---|
| 55 | $gnodes = $data_gatherer->getNodes(); |
---|
| 56 | $cpus = $data_gatherer->getCpus(); |
---|
| 57 | $use_fqdn = $data_gatherer->getUsingFQDN(); |
---|
[114] | 58 | |
---|
[743] | 59 | //print_r( $gnodes ); |
---|
| 60 | |
---|
[328] | 61 | function setupFilterSettings() |
---|
| 62 | { |
---|
| 63 | |
---|
[764] | 64 | global $tpl_data, $filter, $clustername, $piefilter, $data_gatherer, $myxml_data, $filterorder, $_SESSION, $data_gatherer; |
---|
| 65 | global $jobs, $gnodes; |
---|
[122] | 66 | |
---|
[719] | 67 | $filter_image_url = ""; |
---|
[119] | 68 | |
---|
[719] | 69 | foreach( $filter as $filtername => $filtervalue ) |
---|
| 70 | { |
---|
[822] | 71 | $tpl_data[ $filtername ] = $filtervalue; |
---|
[328] | 72 | |
---|
[719] | 73 | $filter_image_url .= "&$filtername=$filtervalue"; |
---|
| 74 | } |
---|
[114] | 75 | |
---|
[719] | 76 | session_start(); |
---|
[326] | 77 | |
---|
[719] | 78 | unset( $_SESSION["data"] ); |
---|
[732] | 79 | $_SESSION["data"] = &$myxml_data; |
---|
[328] | 80 | |
---|
[732] | 81 | $ic = new ClusterImage( $myxml_data, $clustername ); |
---|
[328] | 82 | |
---|
[764] | 83 | $ic->setJobs( $jobs ); |
---|
| 84 | $ic->setNodes( $gnodes ); |
---|
[719] | 85 | $ic->setBig(); |
---|
| 86 | $ic->setNoimage(); |
---|
| 87 | $ic->draw(); |
---|
[326] | 88 | |
---|
[822] | 89 | $tpl_data[ "clusterimage"]= "./image.php?". session_name() . "=" . session_id() ."&c=".rawurlencode($clustername)."&j_view=big-clusterimage".$filter_image_url; |
---|
[326] | 90 | |
---|
[822] | 91 | $tpl_data[ "node_clustermap"]= "yes"; |
---|
| 92 | $tpl_data[ "node_area_map"]= $ic->getImagemapArea(); |
---|
[326] | 93 | |
---|
[822] | 94 | $tpl_data[ "order"]= $filterorder; |
---|
[263] | 95 | } |
---|
[122] | 96 | |
---|
[328] | 97 | function timeToEpoch( $time ) |
---|
| 98 | { |
---|
[732] | 99 | $time_fields = explode( ':', $time ); |
---|
[120] | 100 | |
---|
[719] | 101 | if( count( $time_fields ) == 3 ) |
---|
| 102 | { |
---|
[732] | 103 | $hours = $time_fields[0]; |
---|
| 104 | $minutes = $time_fields[1]; |
---|
| 105 | $seconds = $time_fields[2]; |
---|
[120] | 106 | |
---|
[719] | 107 | } |
---|
| 108 | else if( count( $time_fields ) == 2 ) |
---|
| 109 | { |
---|
[732] | 110 | $hours = 0; |
---|
| 111 | $minutes = $time_fields[0]; |
---|
| 112 | $seconds = $time_fields[1]; |
---|
[120] | 113 | |
---|
[719] | 114 | } |
---|
| 115 | else if( count( $time_fields ) == 1 ) |
---|
| 116 | { |
---|
[732] | 117 | $hours = 0; |
---|
| 118 | $minutes = 0; |
---|
| 119 | $seconds = $time_fields[0]; |
---|
[719] | 120 | } |
---|
[128] | 121 | |
---|
[732] | 122 | $myepoch = intval( $seconds + (intval( $minutes * 60 )) + (intval( $hours * 3600 )) ); |
---|
[128] | 123 | |
---|
[719] | 124 | return $myepoch; |
---|
[120] | 125 | } |
---|
| 126 | |
---|
[328] | 127 | function colorRed( $color ) |
---|
| 128 | { |
---|
[719] | 129 | return substr( $color, 0, 2 ); |
---|
[114] | 130 | } |
---|
[328] | 131 | |
---|
| 132 | function colorGreen( $color ) |
---|
| 133 | { |
---|
[719] | 134 | return substr( $color, 2, 2 ); |
---|
[114] | 135 | } |
---|
[328] | 136 | |
---|
| 137 | function colorBlue( $color ) |
---|
| 138 | { |
---|
[719] | 139 | return substr( $color, 4, 2 ); |
---|
[114] | 140 | } |
---|
| 141 | |
---|
[328] | 142 | function colorDiffer( $first, $second ) |
---|
| 143 | { |
---|
[719] | 144 | // Make sure these two colors differ atleast 50 R/G/B |
---|
| 145 | $min_diff = 50; |
---|
[114] | 146 | |
---|
[732] | 147 | $c1r = hexDec( colorRed( $first ) ); |
---|
| 148 | $c1g = hexDec( colorGreen( $first ) ); |
---|
| 149 | $c1b = hexDec( colorBlue( $first ) ); |
---|
[114] | 150 | |
---|
[732] | 151 | $c2r = hexDec( colorRed( $second ) ); |
---|
| 152 | $c2g = hexDec( colorGreen( $second ) ); |
---|
| 153 | $c2b = hexDec( colorBlue( $second ) ); |
---|
[114] | 154 | |
---|
[732] | 155 | $rdiff = ($c1r >= $c2r) ? $c1r - $c2r : $c2r - $c1r; |
---|
| 156 | $gdiff = ($c1g >= $c2g) ? $c1g - $c2g : $c2g - $c1g; |
---|
| 157 | $bdiff = ($c1b >= $c2b) ? $c1b - $c2b : $c2b - $c1b; |
---|
[114] | 158 | |
---|
[719] | 159 | if( $rdiff >= $min_diff or $gdiff >= $min_diff or $bdiff >= $min_diff ) |
---|
| 160 | { |
---|
| 161 | return TRUE; |
---|
[328] | 162 | |
---|
[719] | 163 | } |
---|
| 164 | else |
---|
| 165 | { |
---|
| 166 | return FALSE; |
---|
| 167 | } |
---|
[114] | 168 | } |
---|
| 169 | |
---|
[328] | 170 | function randomColor( $known_colors ) |
---|
| 171 | { |
---|
[719] | 172 | // White (000000) would be invisible |
---|
[732] | 173 | $start = "004E00"; |
---|
[719] | 174 | |
---|
[732] | 175 | $start_red = colorRed( $start ); |
---|
| 176 | $start_green = colorGreen( $start ); |
---|
| 177 | $start_blue = colorBlue( $start ); |
---|
[719] | 178 | |
---|
[732] | 179 | $end = "FFFFFF"; |
---|
[114] | 180 | |
---|
[732] | 181 | $end_red = colorRed( $end ); |
---|
| 182 | $end_green = colorGreen( $end ); |
---|
[719] | 183 | $end_blue = colorBlue( $end ); |
---|
[114] | 184 | |
---|
[732] | 185 | $change_color= TRUE; |
---|
[114] | 186 | |
---|
[719] | 187 | while( $change_color ) |
---|
| 188 | { |
---|
[732] | 189 | $change_color= FALSE; |
---|
[114] | 190 | |
---|
[719] | 191 | $new_red = rand( hexDec( $start_red ), hexDec( $end_red ) ); |
---|
[732] | 192 | $new_green = rand( hexDec( $start_green ), hexDec( $end_green ) ); |
---|
| 193 | $new_blue = rand( hexDec( $start_blue ), hexDec( $end_blue ) ); |
---|
[114] | 194 | |
---|
[719] | 195 | $new = decHex( $new_red ) . decHex( $new_green ) . decHex( $new_blue ); |
---|
[114] | 196 | |
---|
[719] | 197 | foreach( $known_colors as $old ) |
---|
| 198 | { |
---|
| 199 | if( !colorDiffer( $new, $old ) ) |
---|
| 200 | { |
---|
| 201 | $change_color = TRUE; |
---|
| 202 | } |
---|
| 203 | } |
---|
| 204 | } |
---|
[114] | 205 | |
---|
[719] | 206 | // Whoa! Actually found a good color ;) |
---|
| 207 | return $new; |
---|
[114] | 208 | } |
---|
| 209 | |
---|
[328] | 210 | function sortJobs( $jobs, $sortby, $sortorder ) |
---|
| 211 | { |
---|
[719] | 212 | $sorted = array(); |
---|
[114] | 213 | |
---|
[719] | 214 | $cmp = create_function( '$a, $b', |
---|
| 215 | "global \$sortby, \$sortorder;". |
---|
[116] | 216 | |
---|
[719] | 217 | "if( \$a == \$b ) return 0;". |
---|
[116] | 218 | |
---|
[719] | 219 | "if (\$sortorder==\"desc\")". |
---|
[818] | 220 | "return ( \$a > \$b ) ? 1 : -1;". |
---|
[719] | 221 | "else if (\$sortorder==\"asc\")". |
---|
[818] | 222 | "return ( \$a < \$b ) ? 1 : -1;" ); |
---|
[117] | 223 | |
---|
[719] | 224 | if( isset( $jobs ) && count( $jobs ) > 0 ) |
---|
| 225 | { |
---|
| 226 | foreach( $jobs as $jobid => $jobattrs ) |
---|
| 227 | { |
---|
[732] | 228 | $state = $jobattrs['status']; |
---|
| 229 | $owner = $jobattrs['owner']; |
---|
| 230 | $queue = $jobattrs['queue']; |
---|
| 231 | $name = $jobattrs['name']; |
---|
| 232 | $req_cpu = $jobattrs['requested_time']; |
---|
| 233 | $req_memory= $jobattrs['requested_memory']; |
---|
[117] | 234 | |
---|
[719] | 235 | if( $state == 'R' ) |
---|
| 236 | { |
---|
| 237 | $nodes = count( $jobattrs['nodes'] ); |
---|
| 238 | } |
---|
| 239 | else |
---|
| 240 | { |
---|
| 241 | $nodes = $jobattrs['nodes']; |
---|
| 242 | } |
---|
[117] | 243 | |
---|
[719] | 244 | $ppn = (int) $jobattrs['ppn'] ? $jobattrs['ppn'] : 1; |
---|
[731] | 245 | $cpus = $nodes * $ppn; |
---|
| 246 | $queued_time = (int) $jobattrs['queued_timestamp']; |
---|
| 247 | $start_time = (int) $jobattrs['start_timestamp']; |
---|
| 248 | $runningtime = $report_time - $start_time; |
---|
[117] | 249 | |
---|
[719] | 250 | switch( $sortby ) |
---|
| 251 | { |
---|
| 252 | case "id": |
---|
| 253 | $sorted[$jobid] = $jobid; |
---|
| 254 | break; |
---|
[117] | 255 | |
---|
[719] | 256 | case "state": |
---|
| 257 | $sorted[$jobid] = $state; |
---|
| 258 | break; |
---|
[117] | 259 | |
---|
[719] | 260 | case "owner": |
---|
| 261 | $sorted[$jobid] = $owner; |
---|
| 262 | break; |
---|
[117] | 263 | |
---|
[719] | 264 | case "queue": |
---|
| 265 | $sorted[$jobid] = $queue; |
---|
| 266 | break; |
---|
[117] | 267 | |
---|
[719] | 268 | case "name": |
---|
| 269 | $sorted[$jobid] = $name; |
---|
| 270 | break; |
---|
[117] | 271 | |
---|
[719] | 272 | case "req_cpu": |
---|
| 273 | $sorted[$jobid] = timeToEpoch( $req_cpu ); |
---|
| 274 | break; |
---|
[117] | 275 | |
---|
[719] | 276 | case "req_mem": |
---|
| 277 | $sorted[$jobid] = $req_memory; |
---|
| 278 | break; |
---|
[117] | 279 | |
---|
[719] | 280 | case "nodes": |
---|
| 281 | $sorted[$jobid] = $nodes; |
---|
| 282 | break; |
---|
[117] | 283 | |
---|
[719] | 284 | case "cpus": |
---|
| 285 | $sorted[$jobid] = $cpus; |
---|
| 286 | break; |
---|
[245] | 287 | |
---|
[719] | 288 | case "queued": |
---|
| 289 | $sorted[$jobid] = $queued_time; |
---|
| 290 | break; |
---|
[117] | 291 | |
---|
[719] | 292 | case "start": |
---|
| 293 | $sorted[$jobid] = $start_time; |
---|
| 294 | break; |
---|
[117] | 295 | |
---|
[719] | 296 | case "runningtime": |
---|
| 297 | $sorted[$jobid] = $runningtime; |
---|
| 298 | break; |
---|
[117] | 299 | |
---|
[719] | 300 | default: |
---|
| 301 | break; |
---|
| 302 | } |
---|
| 303 | } |
---|
| 304 | } |
---|
[301] | 305 | |
---|
[719] | 306 | if( $sortorder == "asc" ) |
---|
| 307 | { |
---|
[818] | 308 | asort( $sorted ); |
---|
[719] | 309 | } |
---|
| 310 | else if( $sortorder == "desc" ) |
---|
| 311 | { |
---|
[818] | 312 | arsort( $sorted ); |
---|
[719] | 313 | } |
---|
[117] | 314 | |
---|
[719] | 315 | return $sorted; |
---|
[117] | 316 | } |
---|
| 317 | |
---|
[328] | 318 | function makeOverview() |
---|
| 319 | { |
---|
[753] | 320 | global $dwoo, $tpl, $tpl_data, $jobs, $nodes, $heartbeat, $clustername, $tpl_data; |
---|
[719] | 321 | global $sortorder, $sortby, $filter, $sh, $hc, $m, $range; |
---|
| 322 | global $cluster_url, $get_metric_string, $host_url, $metrics; |
---|
| 323 | global $start, $end, $reports, $gnodes, $default_showhosts; |
---|
| 324 | global $COLUMN_QUEUED, $COLUMN_REQUESTED_MEMORY, $COLUMN_NODES, $hostname; |
---|
[764] | 325 | global $cluster, $use_fqdn, $myxml_data, $data_gatherer; |
---|
[126] | 326 | |
---|
[719] | 327 | $metricname = $m; |
---|
[731] | 328 | if( isset($conf['default_metric']) and ($metricname =='') ) |
---|
| 329 | $metricname = $conf['default_metric']; |
---|
| 330 | else |
---|
| 331 | if( isset( $m ) ) |
---|
| 332 | $metricname = $m; |
---|
| 333 | else |
---|
| 334 | $metricname = "load_one"; |
---|
[328] | 335 | |
---|
[822] | 336 | $tpl_data["sortorder"]= $sortorder; |
---|
| 337 | $tpl_data["sortby"]= $sortby; |
---|
[117] | 338 | |
---|
[732] | 339 | $sorted_jobs = sortJobs( $jobs, $sortby, $sortorder ); |
---|
[117] | 340 | |
---|
[732] | 341 | $even = 1; |
---|
[118] | 342 | |
---|
[732] | 343 | $used_jobs = 0; |
---|
| 344 | $used_cpus = 0; |
---|
[719] | 345 | $used_nodes = 0; |
---|
[124] | 346 | |
---|
[732] | 347 | $queued_jobs = 0; |
---|
| 348 | $queued_nodes = 0; |
---|
| 349 | $queued_cpus = 0; |
---|
[208] | 350 | |
---|
[732] | 351 | $total_nodes = 0; |
---|
[719] | 352 | $total_cpus = 0; |
---|
| 353 | $total_jobs = 0; |
---|
[208] | 354 | |
---|
[719] | 355 | $all_used_nodes = array(); |
---|
[732] | 356 | $total_used_nodes = array(); |
---|
[124] | 357 | |
---|
[732] | 358 | $running_name_nodes = array(); |
---|
[208] | 359 | |
---|
[732] | 360 | $running_nodes = 0; |
---|
| 361 | $running_jobs = 0; |
---|
| 362 | $running_cpus = 0; |
---|
[208] | 363 | |
---|
[732] | 364 | $avail_nodes = count( $gnodes ); |
---|
[719] | 365 | $avail_cpus = cluster_sum("cpu_num", $metrics); |
---|
[135] | 366 | |
---|
[732] | 367 | $view_cpus = 0; |
---|
| 368 | $view_jobs = 0; |
---|
[719] | 369 | $view_nodes = 0; |
---|
[135] | 370 | |
---|
[732] | 371 | $all_nodes = 0; |
---|
| 372 | $all_jobs = 0; |
---|
| 373 | $all_cpus = 0; |
---|
[135] | 374 | |
---|
[732] | 375 | $view_name_nodes = array(); |
---|
[208] | 376 | |
---|
[719] | 377 | // Is the "requested memory" column enabled in the config |
---|
| 378 | // |
---|
| 379 | if( $COLUMN_REQUESTED_MEMORY ) |
---|
| 380 | { |
---|
[822] | 381 | $tpl_data[ "column_header_req_mem"]= "yes"; |
---|
[719] | 382 | } |
---|
[241] | 383 | |
---|
[719] | 384 | // Is the "nodes hostnames" column enabled in the config |
---|
| 385 | // |
---|
| 386 | if( $COLUMN_NODES ) |
---|
| 387 | { |
---|
[822] | 388 | $tpl_data[ "column_header_nodes"]= "yes"; |
---|
[719] | 389 | } |
---|
[299] | 390 | |
---|
[719] | 391 | // Is the "queued time" column enabled in the config |
---|
| 392 | // |
---|
| 393 | if( $COLUMN_QUEUED ) |
---|
| 394 | { |
---|
[822] | 395 | $tpl_data[ "column_header_queued"]= "yes" ; |
---|
[719] | 396 | } |
---|
[242] | 397 | |
---|
[732] | 398 | $last_displayed_job = null; |
---|
[263] | 399 | |
---|
[732] | 400 | $rjqj_host = null; |
---|
[406] | 401 | |
---|
[732] | 402 | $na_nodes = 0; |
---|
| 403 | $na_cpus = 0; |
---|
[512] | 404 | |
---|
[719] | 405 | foreach( $metrics as $bhost => $bmetric ) |
---|
| 406 | { |
---|
| 407 | foreach( $bmetric as $mname => $mval ) |
---|
| 408 | { |
---|
[726] | 409 | if( ( $mname == 'zplugin_monarch_rj' ) || ($mname == 'zplugin_monarch_qj') ) |
---|
[719] | 410 | { |
---|
[732] | 411 | $rjqj_host = $bhost; |
---|
[719] | 412 | } |
---|
| 413 | } |
---|
| 414 | } |
---|
[409] | 415 | |
---|
[719] | 416 | foreach( $gnodes as $ghost => $gnode ) |
---|
| 417 | { |
---|
| 418 | if( $gnode->isDown() || $gnode->isOffline() ) |
---|
| 419 | { |
---|
[732] | 420 | $na_nodes += 1; |
---|
| 421 | $na_cpus += $metrics[$ghost]['cpu_num']['VAL']; |
---|
[719] | 422 | } |
---|
| 423 | } |
---|
[516] | 424 | |
---|
[753] | 425 | $node_list = array(); |
---|
[409] | 426 | |
---|
[719] | 427 | foreach( $sorted_jobs as $jobid => $sortdec ) |
---|
| 428 | { |
---|
| 429 | $report_time = $jobs[$jobid]['reported']; |
---|
[117] | 430 | |
---|
[719] | 431 | if( $jobs[$jobid]['status'] == 'R' ) |
---|
| 432 | { |
---|
| 433 | $nodes = count( $jobs[$jobid]['nodes'] ); |
---|
| 434 | } |
---|
| 435 | else if( $jobs[$jobid]['status'] == 'Q' ) |
---|
| 436 | { |
---|
| 437 | $nodes = $jobs[$jobid]['nodes']; |
---|
| 438 | } |
---|
[208] | 439 | |
---|
[732] | 440 | $ppn = isset( $jobs[$jobid]['ppn'] ) ? $jobs[$jobid]['ppn'] : 1; |
---|
| 441 | $cpus = $nodes * $ppn; |
---|
[124] | 442 | |
---|
[719] | 443 | if( $report_time == $heartbeat ) |
---|
| 444 | { |
---|
| 445 | $display_job = 1; |
---|
[124] | 446 | |
---|
[719] | 447 | if( $jobs[$jobid]['status'] == 'R' ) |
---|
| 448 | { |
---|
| 449 | foreach( $jobs[$jobid]['nodes'] as $tempnode ) |
---|
| 450 | { |
---|
| 451 | $all_used_nodes[] = $tempnode; |
---|
| 452 | } |
---|
| 453 | } |
---|
[208] | 454 | |
---|
[719] | 455 | $used_cpus += $cpus; |
---|
[135] | 456 | |
---|
[719] | 457 | if( $jobs[$jobid]['status'] == 'R' ) |
---|
| 458 | { |
---|
| 459 | $running_cpus += $cpus; |
---|
[328] | 460 | |
---|
[719] | 461 | $running_jobs++; |
---|
[117] | 462 | |
---|
[719] | 463 | $found_node_job = 0; |
---|
[268] | 464 | |
---|
[719] | 465 | foreach( $jobs[$jobid]['nodes'] as $tempnode ) |
---|
| 466 | { |
---|
| 467 | $running_name_nodes[] = $tempnode; |
---|
[263] | 468 | |
---|
[719] | 469 | if( isset( $hostname ) && $hostname != '' ) |
---|
| 470 | { |
---|
| 471 | $domain_len = 0 - strlen( $jobs[$jobid]['domain'] ); |
---|
| 472 | $hostnode = $tempnode; |
---|
[328] | 473 | |
---|
[719] | 474 | if( $use_fqdn == 1) |
---|
| 475 | { |
---|
| 476 | if( substr( $hostnode, $domain_len ) != $jobs[$jobid]['domain'] ) |
---|
| 477 | { |
---|
| 478 | $hostnode = $hostnode. '.'. $jobs[$jobid]['domain']; |
---|
| 479 | } |
---|
| 480 | } |
---|
[263] | 481 | |
---|
[719] | 482 | if( $hostname == $hostnode ) |
---|
| 483 | { |
---|
| 484 | $found_node_job = 1; |
---|
| 485 | $display_job = 1; |
---|
| 486 | } |
---|
| 487 | else if( !$found_node_job ) |
---|
| 488 | { |
---|
| 489 | $display_job = 0; |
---|
| 490 | } |
---|
| 491 | } |
---|
| 492 | } |
---|
| 493 | } |
---|
[117] | 494 | |
---|
[719] | 495 | if( $jobs[$jobid]['status'] == 'Q' ) |
---|
| 496 | { |
---|
| 497 | if( isset( $hostname ) && $hostname != '' ) |
---|
| 498 | { |
---|
| 499 | $display_job = 0; |
---|
| 500 | } |
---|
[263] | 501 | |
---|
[732] | 502 | $queued_cpus += $cpus; |
---|
| 503 | $queued_nodes += $nodes; |
---|
[328] | 504 | |
---|
[719] | 505 | $queued_jobs++; |
---|
| 506 | } |
---|
[208] | 507 | |
---|
[719] | 508 | foreach( $filter as $filtername=>$filtervalue ) |
---|
| 509 | { |
---|
| 510 | if( $filtername == 'id' && $jobid != $filtervalue ) |
---|
| 511 | { |
---|
| 512 | $display_job = 0; |
---|
| 513 | } |
---|
| 514 | else if( $filtername == 'state' && $jobs[$jobid]['status'] != $filtervalue ) |
---|
| 515 | { |
---|
| 516 | $display_job = 0; |
---|
| 517 | } |
---|
| 518 | else if( $filtername == 'queue' && $jobs[$jobid]['queue'] != $filtervalue ) |
---|
| 519 | { |
---|
| 520 | $display_job = 0; |
---|
| 521 | } |
---|
| 522 | else if( $filtername == 'owner' && $jobs[$jobid]['owner'] != $filtervalue ) |
---|
| 523 | { |
---|
| 524 | $display_job = 0; |
---|
| 525 | } |
---|
| 526 | } |
---|
[118] | 527 | |
---|
[753] | 528 | |
---|
[719] | 529 | if( $display_job ) |
---|
| 530 | { |
---|
[816] | 531 | unset( $job_loop ); |
---|
[753] | 532 | $job_loop = array(); |
---|
| 533 | $job_loop["clustername"] = $clustername; |
---|
[263] | 534 | |
---|
[753] | 535 | $job_loop["id"] = $jobid; |
---|
| 536 | |
---|
[719] | 537 | $last_displayed_job = $jobid; |
---|
[263] | 538 | |
---|
[753] | 539 | $job_loop["state"] = $jobs[$jobid]['status']; |
---|
[240] | 540 | |
---|
[719] | 541 | $fullstate = ''; |
---|
[328] | 542 | |
---|
[719] | 543 | if( $jobs[$jobid]['status'] == 'R' ) |
---|
| 544 | { |
---|
| 545 | $fullstate = "Running"; |
---|
| 546 | } |
---|
| 547 | else if( $jobs[$jobid]['status'] == 'Q' ) |
---|
| 548 | { |
---|
| 549 | $fullstate = "Queued"; |
---|
| 550 | } |
---|
[240] | 551 | |
---|
[753] | 552 | $job_loop["fullstate"] = $fullstate; |
---|
[719] | 553 | |
---|
[753] | 554 | $job_loop["owner"] = $jobs[$jobid]['owner']; |
---|
| 555 | $job_loop["queue"] = $jobs[$jobid]['queue']; |
---|
[240] | 556 | |
---|
[719] | 557 | $fulljobname = $jobs[$jobid]['name']; |
---|
[753] | 558 | $shortjobname = ''; |
---|
[240] | 559 | |
---|
[753] | 560 | $job_loop["fulljobname"] = $fulljobname; |
---|
[240] | 561 | |
---|
[719] | 562 | $fulljobname_fields = explode( ' ', $fulljobname ); |
---|
[311] | 563 | |
---|
[719] | 564 | $capjobname = 0; |
---|
[311] | 565 | |
---|
[719] | 566 | if( strlen( $fulljobname_fields[0] ) > 10 ) |
---|
| 567 | { |
---|
| 568 | $capjobname = 1; |
---|
| 569 | } |
---|
[311] | 570 | |
---|
[719] | 571 | if( $capjobname ) |
---|
| 572 | { |
---|
[753] | 573 | $job_loop[ "jobname_hint_start" ] = "yes"; |
---|
[240] | 574 | |
---|
[719] | 575 | $shortjobname = substr( $fulljobname, 0, 10 ) . '..'; |
---|
| 576 | } |
---|
| 577 | else |
---|
| 578 | { |
---|
| 579 | $shortjobname = $fulljobname; |
---|
| 580 | } |
---|
| 581 | |
---|
[753] | 582 | $job_loop["name"] = $shortjobname; |
---|
[240] | 583 | |
---|
[719] | 584 | if( $capjobname ) |
---|
| 585 | { |
---|
[753] | 586 | $job_loop[ "jobname_hint_end" ] = "yes"; |
---|
[719] | 587 | } |
---|
[240] | 588 | |
---|
[719] | 589 | $domain = $jobs[$jobid]['domain']; |
---|
[135] | 590 | |
---|
[753] | 591 | $job_loop["req_cpu"] = makeTime( timeToEpoch( $jobs[$jobid]['requested_time'] ) ); |
---|
[328] | 592 | |
---|
[719] | 593 | if( $COLUMN_REQUESTED_MEMORY ) |
---|
| 594 | { |
---|
[753] | 595 | $job_loop[ "column_req_mem" ] = "yes"; |
---|
| 596 | $job_loop["req_memory"] = $jobs[$jobid]['requested_memory']; |
---|
[719] | 597 | } |
---|
[135] | 598 | |
---|
[299] | 599 | |
---|
[719] | 600 | if( $COLUMN_QUEUED ) |
---|
| 601 | { |
---|
[753] | 602 | $job_loop[ "column_queued" ] = "yes"; |
---|
| 603 | $job_loop["queued"] = makeDate( $jobs[$jobid]['queued_timestamp'] ); |
---|
[719] | 604 | } |
---|
| 605 | if( $COLUMN_NODES ) |
---|
| 606 | { |
---|
[753] | 607 | $job_loop[ "column_nodes" ] = "yes"; |
---|
| 608 | //echo "colum nodes"; |
---|
[719] | 609 | } |
---|
[242] | 610 | |
---|
[732] | 611 | $ppn = isset( $jobs[$jobid]['ppn'] ) ? $jobs[$jobid]['ppn'] : 1; |
---|
| 612 | $cpus = $nodes * $ppn; |
---|
[119] | 613 | |
---|
[753] | 614 | $job_loop["nodes"] = $nodes; |
---|
| 615 | $job_loop["cpus"] = $cpus; |
---|
[328] | 616 | |
---|
[732] | 617 | $start_time= (int) $jobs[$jobid]['start_timestamp']; |
---|
| 618 | $job_start = $start_time; |
---|
[328] | 619 | |
---|
[738] | 620 | |
---|
[732] | 621 | $view_cpus += $cpus; |
---|
[328] | 622 | |
---|
[719] | 623 | $view_jobs++; |
---|
[124] | 624 | |
---|
[719] | 625 | if( $jobs[$jobid]['status'] == 'R' ) |
---|
| 626 | { |
---|
[763] | 627 | $job_runningtime = $heartbeat - $start_time; |
---|
[738] | 628 | if( $rjqj_start == null ) |
---|
| 629 | { |
---|
[763] | 630 | $rjqj_start = intval( $start_time - (intval( $job_runningtime * 0.10 ) ) ); |
---|
[738] | 631 | } |
---|
| 632 | else if( $start_time < $rjqj_start ) |
---|
| 633 | { |
---|
[763] | 634 | $rjqj_start = intval( $start_time - (intval( $job_runningtime * 0.10 ) ) ); |
---|
[738] | 635 | } |
---|
| 636 | |
---|
[719] | 637 | foreach( $jobs[$jobid]['nodes'] as $tempnode ) |
---|
| 638 | { |
---|
| 639 | $view_name_nodes[] = $tempnode; |
---|
| 640 | } |
---|
[299] | 641 | |
---|
[719] | 642 | if( $COLUMN_NODES ) |
---|
| 643 | { |
---|
[753] | 644 | $job_loop[ "column_nodes" ] = "yes"; |
---|
[328] | 645 | |
---|
[719] | 646 | $mynodehosts = array(); |
---|
[328] | 647 | |
---|
[730] | 648 | foreach( $jobs[$jobid]['nodes'] as $shortnode ) |
---|
[719] | 649 | { |
---|
| 650 | if( $use_fqdn == 1) |
---|
| 651 | { |
---|
[732] | 652 | $mynode = $shortnode.".".$jobs[$jobid]['domain']; |
---|
[719] | 653 | } |
---|
[732] | 654 | $myhost_href = "./?c=".$clustername."&h=".$mynode; |
---|
| 655 | $mynodehosts[] = "<A HREF=\"".$myhost_href."\">".$shortnode."</A>"; |
---|
[719] | 656 | } |
---|
[328] | 657 | |
---|
[732] | 658 | $nodes_hostnames = implode( " ", $mynodehosts ); |
---|
[328] | 659 | |
---|
[753] | 660 | $job_loop["nodes_hostnames"] = $nodes_hostnames; |
---|
[719] | 661 | } |
---|
| 662 | } |
---|
| 663 | else if( $jobs[$jobid]['status'] == 'Q' ) |
---|
| 664 | { |
---|
| 665 | $view_nodes += (int) $jobs[$jobid]['nodes']; |
---|
| 666 | } |
---|
[135] | 667 | |
---|
[719] | 668 | if( $even ) |
---|
| 669 | { |
---|
[753] | 670 | $job_loop["nodeclass"] = "even"; |
---|
[119] | 671 | |
---|
[719] | 672 | $even = 0; |
---|
| 673 | } |
---|
| 674 | else |
---|
| 675 | { |
---|
[753] | 676 | $job_loop["nodeclass"] = "odd"; |
---|
[119] | 677 | |
---|
[719] | 678 | $even = 1; |
---|
| 679 | } |
---|
[119] | 680 | |
---|
[719] | 681 | if( $start_time ) |
---|
| 682 | { |
---|
[732] | 683 | $runningtime = makeTime( $report_time - $start_time ); |
---|
[719] | 684 | $job_runningtime = $heartbeat - $start_time; |
---|
[119] | 685 | |
---|
[753] | 686 | $job_loop["started"] = makeDate( $start_time ); |
---|
| 687 | $job_loop["runningtime"] = $runningtime; |
---|
[719] | 688 | } |
---|
[815] | 689 | $node_list[] = &$job_loop; |
---|
[719] | 690 | } |
---|
[822] | 691 | $tpl_data["node_list"]= &$node_list ; |
---|
[719] | 692 | } |
---|
| 693 | } |
---|
[763] | 694 | if( intval($view_jobs) == 1 and $start_time ) |
---|
| 695 | { |
---|
| 696 | if( $last_displayed_job != null ) |
---|
| 697 | { |
---|
| 698 | $filter['id'] = $last_displayed_job; |
---|
| 699 | } |
---|
| 700 | } |
---|
[738] | 701 | // Running / queued amount jobs graph |
---|
| 702 | // |
---|
| 703 | if( $rjqj_host != null ) |
---|
| 704 | { |
---|
[761] | 705 | $rjqj_graphargs = "?z=overview-medium&c=$clustername&h=$rjqj_host&g=job_report&r=$range"; |
---|
[738] | 706 | if( $range == 'job' ) |
---|
| 707 | { |
---|
| 708 | $rjqj_end = time(); |
---|
[768] | 709 | |
---|
| 710 | if( $rjqj_start == null ) |
---|
| 711 | { // probably no running jobs in this view: only queued |
---|
| 712 | $rjqj_start = $rjqj_end - (24 * 3600); // default to 1 day |
---|
| 713 | } |
---|
[758] | 714 | $rjqj_title = rawurlencode( makeTime( ($rjqj_end - $rjqj_start) ) ); |
---|
| 715 | $rjqj_graphargs .= "&period_start=$rjqj_start&period_stop=$rjqj_end&t=$rjqj_title"; |
---|
[738] | 716 | } |
---|
| 717 | else |
---|
| 718 | { |
---|
| 719 | $rjqj_graphargs .= "&st=$cluster[LOCALTIME]"; |
---|
| 720 | } |
---|
[763] | 721 | if( intval($view_jobs) == 1 and $start_time ) |
---|
| 722 | { |
---|
| 723 | $job_start = $jobs[$last_displayed_job]['start_timestamp']; |
---|
| 724 | $rjqj_graphargs .= "&job_start=$start_time"; |
---|
| 725 | } |
---|
[208] | 726 | |
---|
[738] | 727 | $rjqj_str = "<A HREF=\"./graph.php$rjqj_graphargs\">"; |
---|
[796] | 728 | $rjqj_str .= "<IMG BORDER=0 SRC=\"./graph.php$rjqj_graphargs\">"; |
---|
[738] | 729 | $rjqj_str .= "</A>"; |
---|
| 730 | |
---|
[822] | 731 | $tpl_data[ "rjqj_graph"]= $rjqj_str ; |
---|
[738] | 732 | } |
---|
| 733 | |
---|
[719] | 734 | $all_used_nodes = array_unique( $all_used_nodes ); |
---|
[732] | 735 | $view_name_nodes = array_unique( $view_name_nodes ); |
---|
| 736 | $running_name_nodes = array_unique( $running_name_nodes ); |
---|
[124] | 737 | |
---|
[719] | 738 | $used_nodes = count( $all_used_nodes ); |
---|
[732] | 739 | $view_nodes += count( $view_name_nodes ); |
---|
| 740 | $running_nodes += count( $running_name_nodes ); |
---|
[208] | 741 | |
---|
[732] | 742 | $total_nodes = $queued_nodes + $running_nodes; |
---|
[719] | 743 | $total_cpus = $queued_cpus + $running_cpus; |
---|
| 744 | $total_jobs = $queued_jobs + $running_jobs; |
---|
[135] | 745 | |
---|
[719] | 746 | $free_nodes = $avail_nodes - $running_nodes - $na_nodes; |
---|
[732] | 747 | $free_nodes = ( $free_nodes >= 0 ) ? $free_nodes : 0; |
---|
| 748 | $free_cpus = $avail_cpus - $running_cpus - $na_cpus; |
---|
| 749 | $free_cpus = ( $free_cpus >= 0 ) ? $free_cpus : 0; |
---|
[208] | 750 | |
---|
[822] | 751 | $tpl_data[ "avail_nodes"]= $avail_nodes ; |
---|
| 752 | $tpl_data[ "avail_cpus"]= $avail_cpus ; |
---|
[208] | 753 | |
---|
[822] | 754 | $tpl_data[ "queued_nodes"]= $queued_nodes ; |
---|
| 755 | $tpl_data[ "queued_jobs"]= $queued_jobs ; |
---|
| 756 | $tpl_data[ "queued_cpus"]= $queued_cpus ; |
---|
[208] | 757 | |
---|
[719] | 758 | // Only display "Unavailable" in count overview there are any |
---|
| 759 | // |
---|
| 760 | if( $na_nodes > 0 ) |
---|
| 761 | { |
---|
[822] | 762 | $tpl_data[ "na_nodes"]= "yes"; |
---|
[512] | 763 | |
---|
[822] | 764 | $tpl_data[ "na_nodes"]= $na_nodes ; |
---|
| 765 | $tpl_data[ "na_cpus"]= $na_cpus ; |
---|
[719] | 766 | } |
---|
[517] | 767 | |
---|
[822] | 768 | $tpl_data[ "total_nodes"]= $total_nodes ; |
---|
| 769 | $tpl_data[ "total_jobs"]= $total_jobs ; |
---|
| 770 | $tpl_data[ "total_cpus"]= $total_cpus ; |
---|
[135] | 771 | |
---|
[822] | 772 | $tpl_data[ "running_nodes"]= $running_nodes ; |
---|
| 773 | $tpl_data[ "running_jobs"]= $running_jobs ; |
---|
| 774 | $tpl_data[ "running_cpus"]= $running_cpus ; |
---|
[208] | 775 | |
---|
[822] | 776 | $tpl_data[ "used_nodes"]= $used_nodes ; |
---|
| 777 | $tpl_data[ "used_jobs"]= $used_jobs ; |
---|
| 778 | $tpl_data[ "used_cpus"]= $used_cpus ; |
---|
[208] | 779 | |
---|
[822] | 780 | $tpl_data[ "free_nodes"]= $free_nodes ; |
---|
| 781 | $tpl_data[ "free_cpus"]= $free_cpus ; |
---|
[135] | 782 | |
---|
[822] | 783 | $tpl_data[ "view_nodes"]= $view_nodes ; |
---|
| 784 | $tpl_data[ "view_jobs"]= $view_jobs ; |
---|
| 785 | $tpl_data[ "view_cpus"]= $view_cpus ; |
---|
[126] | 786 | |
---|
[822] | 787 | $tpl_data[ "report_time"]= makeDate( $heartbeat); |
---|
[328] | 788 | |
---|
[263] | 789 | |
---|
[719] | 790 | global $longtitle, $title; |
---|
[406] | 791 | |
---|
[719] | 792 | $longtitle = "Batch Report :: Powered by Job Monarch!"; |
---|
| 793 | $title = "Batch Report"; |
---|
[406] | 794 | |
---|
[719] | 795 | makeHeader( 'overview', $title, $longtitle ); |
---|
[406] | 796 | |
---|
[719] | 797 | setupFilterSettings(); |
---|
[263] | 798 | |
---|
[719] | 799 | if( intval($view_jobs) == 1 and $start_time ) |
---|
| 800 | { |
---|
[822] | 801 | $tpl_data[ "showhosts"]= "yes" ; |
---|
[126] | 802 | |
---|
[719] | 803 | $showhosts = isset($sh) ? $sh : $default_showhosts; |
---|
[126] | 804 | |
---|
[822] | 805 | $tpl_data[ "checked$showhosts"]= "checked" ; |
---|
[126] | 806 | |
---|
[753] | 807 | $sorted_list = array(); |
---|
| 808 | |
---|
[719] | 809 | if( $showhosts ) |
---|
| 810 | { |
---|
| 811 | if( !isset( $start ) ) |
---|
| 812 | { |
---|
| 813 | $start ="jobstart"; |
---|
| 814 | } |
---|
| 815 | if( !isset( $stop ) ) |
---|
| 816 | { |
---|
| 817 | $stop ="now"; |
---|
| 818 | } |
---|
[126] | 819 | |
---|
[731] | 820 | $sorted_hosts = array(); |
---|
[719] | 821 | $hosts_up = $jobs[$filter['id']]['nodes']; |
---|
[126] | 822 | |
---|
[731] | 823 | $r = intval($job_runningtime * 1.2); |
---|
[126] | 824 | |
---|
[719] | 825 | $jobrange = -$r ; |
---|
| 826 | $jobstart = $start_time; |
---|
[402] | 827 | |
---|
[719] | 828 | if ( $reports[$metricname] ) |
---|
| 829 | { |
---|
| 830 | $metricval = "g"; |
---|
| 831 | } |
---|
| 832 | else |
---|
| 833 | { |
---|
| 834 | $metricval = "m"; |
---|
| 835 | } |
---|
| 836 | |
---|
| 837 | foreach ( $hosts_up as $host ) |
---|
| 838 | { |
---|
| 839 | $domain_len = 0 - strlen( $domain ); |
---|
[195] | 840 | |
---|
[719] | 841 | if( $use_fqdn ) |
---|
| 842 | { |
---|
| 843 | if( substr( $host, $domain_len ) != $domain ) |
---|
| 844 | { |
---|
| 845 | $host = $host . '.' . $domain; |
---|
| 846 | } |
---|
| 847 | } |
---|
[733] | 848 | $cpus = 0; |
---|
[328] | 849 | |
---|
[719] | 850 | $cpus = $metrics[$host]["cpu_num"]["VAL"]; |
---|
[328] | 851 | |
---|
[733] | 852 | if( $cpus == 0 ) |
---|
[719] | 853 | { |
---|
| 854 | $cpus = 1; |
---|
| 855 | } |
---|
[328] | 856 | |
---|
[719] | 857 | $load_one = $metrics[$host]["load_one"]['VAL']; |
---|
| 858 | $load = ((float) $load_one) / $cpus; |
---|
[731] | 859 | $host_load[$host] = $load; |
---|
[328] | 860 | |
---|
[719] | 861 | $percent_hosts[load_color($load)] ++; |
---|
[328] | 862 | |
---|
[719] | 863 | if ($metricname=="load_one") |
---|
| 864 | { |
---|
| 865 | $sorted_hosts[$host] = $load; |
---|
| 866 | } |
---|
| 867 | else |
---|
| 868 | { |
---|
| 869 | $sorted_hosts[$host] = $metrics[$host][$metricname]['VAL']; |
---|
| 870 | } |
---|
| 871 | } |
---|
[463] | 872 | |
---|
[719] | 873 | switch ( $sort ) |
---|
| 874 | { |
---|
| 875 | case "descending": |
---|
| 876 | arsort( $sorted_hosts ); |
---|
| 877 | break; |
---|
[328] | 878 | |
---|
[719] | 879 | case "by hostname": |
---|
| 880 | ksort( $sorted_hosts ); |
---|
| 881 | break; |
---|
[328] | 882 | |
---|
[719] | 883 | case "ascending": |
---|
| 884 | asort( $sorted_hosts ); |
---|
| 885 | break; |
---|
[328] | 886 | |
---|
[719] | 887 | default: |
---|
| 888 | break; |
---|
| 889 | } |
---|
[126] | 890 | |
---|
[719] | 891 | // First pass to find the max value in all graphs for this |
---|
| 892 | // metric. The $start,$end variables comes from get_context.php, |
---|
| 893 | // included in index.php. |
---|
| 894 | // |
---|
| 895 | list($min, $max) = find_limits($sorted_hosts, $metricname); |
---|
[126] | 896 | |
---|
[719] | 897 | // Second pass to output the graphs or metrics. |
---|
| 898 | $i = 1; |
---|
[126] | 899 | |
---|
[753] | 900 | $metric_loop = array(); |
---|
[719] | 901 | foreach ( $sorted_hosts as $host=>$value ) |
---|
| 902 | { |
---|
[731] | 903 | $host_url = rawurlencode( $host ); |
---|
| 904 | $cluster_url = rawurlencode( $clustername ); |
---|
[193] | 905 | |
---|
[719] | 906 | $textval = ""; |
---|
[328] | 907 | |
---|
[719] | 908 | $val = $metrics[$host][$metricname]; |
---|
[731] | 909 | $class = "metric"; |
---|
[328] | 910 | |
---|
[719] | 911 | if ( $val["TYPE"] == "timestamp" || $always_timestamp[$metricname] ) |
---|
| 912 | { |
---|
| 913 | $textval = date( "r", $val["VAL"] ); |
---|
| 914 | } |
---|
| 915 | elseif ( $val["TYPE"] == "string" || $val["SLOPE"] == "zero" || $always_constant[$metricname] || ($max_graphs > 0 and $i > $max_graphs )) |
---|
| 916 | { |
---|
| 917 | $textval = $val["VAL"] . " " . $val["UNITS"]; |
---|
| 918 | } |
---|
| 919 | else |
---|
| 920 | { |
---|
[731] | 921 | $job_start = $jobs[$last_displayed_job]['start_timestamp']; |
---|
[805] | 922 | $period_end = $cluster['LOCALTIME']; |
---|
| 923 | $runningtime = intval( $period_end ) - intval( $job_start ); |
---|
[719] | 924 | $load_color = load_color($host_load[$host]); |
---|
[731] | 925 | $period_start = intval( $job_start - (intval( $runningtime * 0.10 ) ) ); |
---|
| 926 | //printf("last job %s job start %s runningtime %s period start %s", $last_displayed_job, $jobstart, $job_runningtime, $period_start); |
---|
[719] | 927 | $graphargs = ($reports[$metricname]) ? "g=$metricname&" : "m=$metricname&"; |
---|
[823] | 928 | $graphargs .= "z=overview-medium&c=$cluster_url&r=$range&h=$host_url&l=$load_color&v=".$val['VAL']."&job_start=$job_start&vl=".$val['UNITS']; |
---|
[739] | 929 | $host_link = "?j_view=overview-host&c=$cluster_url&r=$range&h=$host_url&job_start=$jobstart"; |
---|
| 930 | |
---|
| 931 | if( $range == 'job' ) |
---|
| 932 | { |
---|
| 933 | $graphargs .= "&period_start=$period_start&period_stop=$period_end"; |
---|
| 934 | $host_link .= "&period_start=$period_start&period_stop=$period_end"; |
---|
| 935 | } |
---|
| 936 | else |
---|
| 937 | { |
---|
| 938 | $graphargs .= "&st=$period_end"; |
---|
| 939 | $host_link .= "&st=$period_end"; |
---|
| 940 | } |
---|
[719] | 941 | if( $max > 0 ) |
---|
| 942 | { |
---|
| 943 | $graphargs .= "&x=$max&n=$min"; |
---|
| 944 | } |
---|
| 945 | } |
---|
| 946 | if ($textval) |
---|
| 947 | { |
---|
| 948 | $cell = "<td class=$class>". "<b><a href=$host_link>$host</a></b><br>". "<i>$metricname:</i> <b>$textval</b></td>"; |
---|
| 949 | } else { |
---|
[798] | 950 | $cell = "<A HREF=\"$host_link\">" . "<IMG SRC=\"./graph.php?$graphargs\" " . "ALT=\"$host\" BORDER=0></A>"; |
---|
[719] | 951 | } |
---|
[126] | 952 | |
---|
[753] | 953 | $metric_loop["metric_image"] = $cell; |
---|
[328] | 954 | |
---|
[757] | 955 | //if(! ($i++ % $hostcols) ) |
---|
| 956 | //{ |
---|
| 957 | // $metric_loop["br"] = "</tr><tr>"; |
---|
| 958 | //} |
---|
[753] | 959 | $sorted_list[] = $metric_loop; |
---|
[719] | 960 | } |
---|
[822] | 961 | $tpl_data["sorted_list"]= $sorted_list ; |
---|
[719] | 962 | } |
---|
| 963 | } |
---|
[753] | 964 | $dwoo->output($tpl, $tpl_data); |
---|
[114] | 965 | } |
---|
[753] | 966 | |
---|
[113] | 967 | ?> |
---|