Changeset 731
- Timestamp:
- 03/24/13 02:07:26 (10 years ago)
- Location:
- branches/0.4/web/addons/job_monarch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.4/web/addons/job_monarch/graph.php
r726 r731 36 36 37 37 # Graph specific variables 38 $size = escapeshellcmd( rawurldecode( $ HTTP_GET_VARS["z"] ));39 $graph = escapeshellcmd( rawurldecode( $ HTTP_GET_VARS["g"] ));40 $grid = escapeshellcmd( rawurldecode( $ HTTP_GET_VARS["G"] ));41 $self = escapeshellcmd( rawurldecode( $ HTTP_GET_VARS["me"] ));42 $max = escapeshellcmd( rawurldecode( $ HTTP_GET_VARS["x"] ));43 $min = escapeshellcmd( rawurldecode( $ HTTP_GET_VARS["n"] ));44 $value = escapeshellcmd( rawurldecode( $ HTTP_GET_VARS["v"] ));45 $load_color = escapeshellcmd( rawurldecode( $ HTTP_GET_VARS["l"] ));46 $vlabel = escapeshellcmd( rawurldecode( $ HTTP_GET_VARS["vl"] ));38 $size = escapeshellcmd( rawurldecode( $_GET["z"] )); 39 $graph = escapeshellcmd( rawurldecode( $_GET["g"] )); 40 $grid = escapeshellcmd( rawurldecode( $_GET["G"] )); 41 $self = escapeshellcmd( rawurldecode( $_GET["me"] )); 42 $max = escapeshellcmd( rawurldecode( $_GET["x"] )); 43 $min = escapeshellcmd( rawurldecode( $_GET["n"] )); 44 $value = escapeshellcmd( rawurldecode( $_GET["v"] )); 45 $load_color = escapeshellcmd( rawurldecode( $_GET["l"] )); 46 $vlabel = escapeshellcmd( rawurldecode( $_GET["vl"] )); 47 47 48 48 $cluster = $c; … … 61 61 $width = 300; 62 62 } 63 else if ($size == "overview-medium") 64 { 65 $height = 75; 66 $width = 300; 67 } 63 68 else 64 69 { … … 67 72 } 68 73 74 $jobstart_color = "FF0000"; 75 69 76 if($command) 70 77 { … … 75 82 76 83 $graph = $metricname; 84 85 $rrd_dirs = Array(); 77 86 78 87 if (isset($graph)) … … 81 90 if( isset( $period_start ) && isset( $period_stop ) ) 82 91 { 83 $rrd_dirs = $trd->getRrdDirs( $period_start, $period_stop ); 92 if( $size == 'overview-medium' ) 93 { 94 $rrd_dirs[] = $conf['rrds'] . '/' . $cluster .'/'. $hostname; 95 } 96 else 97 { 98 $rrd_dirs = $trd->getRrdDirs( $period_start, $period_stop ); 99 } 84 100 } 85 101 … … 122 138 ."DEF:'cpu_system${def_nr}'='${rrd_dir}/cpu_system.rrd':'sum':AVERAGE " 123 139 ."DEF:'cpu_idle${def_nr}'='${rrd_dir}/cpu_idle.rrd':'sum':AVERAGE " 124 ."AREA:'cpu_user${def_nr}'# ${cpu_user_color}${user_str} "125 ."STACK:'cpu_nice${def_nr}'# ${cpu_nice_color}${nice_str} "126 ."STACK:'cpu_system${def_nr}'# ${cpu_system_color}${system_str} ";140 ."AREA:'cpu_user${def_nr}'#".$conf['cpu_user_color']."${user_str} " 141 ."STACK:'cpu_nice${def_nr}'#".$conf['cpu_nice_color']."${nice_str} " 142 ."STACK:'cpu_system${def_nr}'#".$conf['cpu_system_color']."${system_str} "; 127 143 128 144 if (file_exists("$rrd_dir/cpu_wio.rrd")) 129 145 { 130 146 $series .= "DEF:'cpu_wio${def_nr}'='${rrd_dir}/cpu_wio.rrd':'sum':AVERAGE " 131 ."STACK:'cpu_wio${def_nr}'# ${cpu_wio_color}${wio_str} ";132 } 133 134 $series .= "STACK:'cpu_idle${def_nr}'# ${cpu_idle_color}${idle_str} ";147 ."STACK:'cpu_wio${def_nr}'#".$conf['cpu_wio_color']."${wio_str} "; 148 } 149 150 $series .= "STACK:'cpu_idle${def_nr}'#".$conf['cpu_idle_color']."${idle_str} "; 135 151 136 152 $def_nr++; … … 222 238 ."CDEF:'bmem_buffers${def_nr}'=mem_buffers${def_nr},1024,* " 223 239 ."CDEF:'bmem_used${def_nr}'='bmem_total${def_nr}','bmem_shared${def_nr}',-,'bmem_free${def_nr}',-,'bmem_cached${def_nr}',-,'bmem_buffers${def_nr}',- " 224 ."AREA:'bmem_used${def_nr}'# ${mem_used_color}${memuse_str} "225 ."STACK:'bmem_shared${def_nr}'# ${mem_shared_color}${memshared_str} "226 ."STACK:'bmem_cached${def_nr}'# ${mem_cached_color}${memcached_str} "227 ."STACK:'bmem_buffers${def_nr}'# ${mem_buffered_color}${membuff_str} ";240 ."AREA:'bmem_used${def_nr}'#".$conf['mem_used_color']."${memuse_str} " 241 ."STACK:'bmem_shared${def_nr}'#".$conf['mem_shared_color']."${memshared_str} " 242 ."STACK:'bmem_cached${def_nr}'#".$conf['mem_cached_color']."${memcached_str} " 243 ."STACK:'bmem_buffers${def_nr}'#".$conf['mem_buffered_color']."${membuff_str} "; 228 244 229 245 if (file_exists("$rrd_dir/swap_total.rrd")) … … 232 248 ."DEF:'swap_free${def_nr}'='${rrd_dir}/swap_free.rrd':'sum':AVERAGE " 233 249 ."CDEF:'bmem_swapped${def_nr}'='swap_total${def_nr}','swap_free${def_nr}',-,1024,* " 234 ."STACK:'bmem_swapped${def_nr}'# ${mem_swapped_color}${memswap_str} ";235 } 236 237 $series .= "LINE2:'bmem_total${def_nr}'# ${cpu_num_color}${total_str} ";250 ."STACK:'bmem_swapped${def_nr}'#".$conf['mem_swapped_color']."${memswap_str} "; 251 } 252 253 $series .= "LINE2:'bmem_total${def_nr}'#".$conf['cpu_num_color']."${total_str} "; 238 254 239 255 $def_nr++; … … 270 286 ."DEF:'proc_run${def_nr}'='${rrd_dir}/proc_run.rrd':'sum':AVERAGE " 271 287 ."DEF:'cpu_num${def_nr}'='${rrd_dir}/cpu_num.rrd':'sum':AVERAGE "; 272 $series .="AREA:'load_one${def_nr}'# ${load_one_color}${load_str} ";273 $series .="LINE2:'cpu_num${def_nr}'# ${cpu_num_color}${cpu_str} ";274 $series .="LINE2:'proc_run${def_nr}'# ${proc_run_color}${run_str} ";288 $series .="AREA:'load_one${def_nr}'#".$conf['load_one_color']."${load_str} "; 289 $series .="LINE2:'cpu_num${def_nr}'#".$conf['cpu_num_color']."${cpu_str} "; 290 $series .="LINE2:'proc_run${def_nr}'#".$conf['proc_run_color']."${run_str} "; 275 291 276 292 $def_nr++; … … 306 322 $series .= "DEF:'bytes_in${def_nr}'='${rrd_dir}/bytes_in.rrd':'sum':AVERAGE " 307 323 ."DEF:'bytes_out${def_nr}'='${rrd_dir}/bytes_out.rrd':'sum':AVERAGE " 308 ."LINE2:'bytes_in${def_nr}'# ${mem_cached_color}${in_str} "309 ."LINE2:'bytes_out${def_nr}'# ${mem_used_color}${out_str} ";324 ."LINE2:'bytes_in${def_nr}'#".$conf['mem_cached_color']."${in_str} " 325 ."LINE2:'bytes_out${def_nr}'#".$conf['mem_used_color']."${out_str} "; 310 326 311 327 $def_nr++; … … 341 357 $series .= "DEF:'bytes_in${def_nr}'='${rrd_dir}/pkts_in.rrd':'sum':AVERAGE " 342 358 ."DEF:'bytes_out${def_nr}'='${rrd_dir}/pkts_out.rrd':'sum':AVERAGE " 343 ."LINE2:'bytes_in${def_nr}'# ${mem_cached_color}${in_str} "344 ."LINE2:'bytes_out${def_nr}'# ${mem_used_color}${out_str} ";359 ."LINE2:'bytes_in${def_nr}'#".$conf['mem_cached_color']."${in_str} " 360 ."LINE2:'bytes_out${def_nr}'#".$conf['mem_used_color']."${out_str} "; 345 361 346 362 $def_nr++; … … 400 416 $rrd_file = "$rrd_dir/$metricname.rrd"; 401 417 $series .= "DEF:'sum${def_nr}'='$rrd_file':'sum':AVERAGE " 402 ."AREA:'sum${def_nr}'# ${default_metric_color}${title_str} ";418 ."AREA:'sum${def_nr}'#".$conf['default_metric_color']."${title_str} "; 403 419 404 420 $def_nr++; -
branches/0.4/web/addons/job_monarch/overview.php
r730 r731 425 425 426 426 $ppn = (int) $jobattrs['ppn'] ? $jobattrs['ppn'] : 1; 427 $cpus 428 $queued_time 429 $start_time 430 $runningtime 427 $cpus = $nodes * $ppn; 428 $queued_time = (int) $jobattrs['queued_timestamp']; 429 $start_time = (int) $jobattrs['start_timestamp']; 430 $runningtime = $report_time - $start_time; 431 431 432 432 switch( $sortby ) … … 508 508 509 509 $metricname = $m; 510 if( isset($conf['default_metric']) and ($metricname =='') ) 511 $metricname = $conf['default_metric']; 512 else 513 if( isset( $m ) ) 514 $metricname = $m; 515 else 516 $metricname = "load_one"; 510 517 511 518 $tpl->assign("sortorder", $sortorder ); … … 985 992 } 986 993 987 $sorted_hosts 994 $sorted_hosts = array(); 988 995 $hosts_up = $jobs[$filter['id']]['nodes']; 989 996 990 $r = intval($job_runningtime * 1.2);997 $r = intval($job_runningtime * 1.2); 991 998 992 999 $jobrange = -$r ; … … 1023 1030 $load_one = $metrics[$host]["load_one"]['VAL']; 1024 1031 $load = ((float) $load_one) / $cpus; 1025 $host_load[$host] 1032 $host_load[$host] = $load; 1026 1033 1027 1034 $percent_hosts[load_color($load)] ++; … … 1068 1075 $tpl->newBlock( "sorted_list" ); 1069 1076 1070 $host_url 1071 $cluster_url 1077 $host_url = rawurlencode( $host ); 1078 $cluster_url = rawurlencode( $clustername ); 1072 1079 1073 1080 $textval = ""; 1074 1081 1075 1082 $val = $metrics[$host][$metricname]; 1076 $class 1077 $host_link 1083 $class = "metric"; 1084 $host_link = "\"../../?c=$cluster_url&h=$host_url&r=job&jr=$jobrange&js=$jobstart\""; 1078 1085 1079 1086 if ( $val["TYPE"] == "timestamp" || $always_timestamp[$metricname] ) … … 1087 1094 else 1088 1095 { 1096 $job_start = $jobs[$last_displayed_job]['start_timestamp']; 1097 $period_end = time(); 1098 $runningtime = time() - intval( $job_start ); 1089 1099 $load_color = load_color($host_load[$host]); 1100 $period_start = intval( $job_start - (intval( $runningtime * 0.10 ) ) ); 1101 //printf("last job %s job start %s runningtime %s period start %s", $last_displayed_job, $jobstart, $job_runningtime, $period_start); 1090 1102 $graphargs = ($reports[$metricname]) ? "g=$metricname&" : "m=$metricname&"; 1091 $graphargs .= "z= small&c=$cluster_url&h=$host_url&l=$load_color&v=".$val['VAL']."&r=job&jr=$jobrange&js=$jobstart";1103 $graphargs .= "z=overview-medium&c=$cluster_url&h=$host_url&l=$load_color&v=".$val['VAL']."&job_start=$job_start&period_start=$period_start&period_stop=$period_end"; 1092 1104 if( $max > 0 ) 1093 1105 { … … 1099 1111 $cell = "<td class=$class>". "<b><a href=$host_link>$host</a></b><br>". "<i>$metricname:</i> <b>$textval</b></td>"; 1100 1112 } else { 1101 $cell = "<td><a href=$host_link>" . "<img src=\". ./../graph.php?$graphargs\" " . "alt=\"$host\" border=0></a></td>";1113 $cell = "<td><a href=$host_link>" . "<img src=\"./graph.php?$graphargs\" " . "alt=\"$host\" border=0></a></td>"; 1102 1114 } 1103 1115
Note: See TracChangeset
for help on using the changeset viewer.