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