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