Changeset 604
- Timestamp:
- 02/17/09 15:57:35 (15 years ago)
- Location:
- trunk/web2/addons/job_monarch
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web2/addons/job_monarch/graph.php
r532 r604 57 57 $hostname = $h; 58 58 59 # Assumes we have a $start variable (set in get_context.php). 60 if ($size == "small") { 61 $height = 40; 62 $width = 130; 63 } else if ($size == "medium") { 64 $height = 75; 65 $width = 300; 66 } else { 67 $height = 100; 68 $width = 400; 69 } 59 //# Assumes we have a $start variable (set in get_context.php). 60 //if ($size == "small") { 61 // $height = 40; 62 // $width = 130; 63 //} else if ($size == "medium") { 64 // $height = 75; 65 // $width = 300; 66 //} else { 67 // $height = 100; 68 // $width = 400; 69 //} 70 71 if( in_array( $size, array_keys( $graph_sizes ) ) ) 72 { 73 $height = $graph_sizes[ $size ][ 'height' ]; 74 $width = $graph_sizes[ $size ][ 'width' ]; 75 } 76 else 77 { 78 $height = $graph_sizes[ 'default' ][ 'height' ]; 79 $width = $graph_sizes[ 'default' ][ 'width' ]; 80 } 81 70 82 71 83 if($command) { … … 75 87 //printf( "cluster = %s hostname = %s metric = %s\n", $cluster, $hostname, $metricname ); 76 88 77 $trd = new TarchRrdGraph( $cluster, $hostname ); 89 if( $archive ) 90 { 91 $trd = new TarchRrdGraph( $cluster, $hostname ); 92 } 78 93 //$rrd_files = $trd->getRrdFiles( $metricname, $start, $stop ); 79 94 … … 82 97 $graph = $metricname; 83 98 84 if (isset($graph)) { 99 if( isset($graph) ) 100 { 85 101 $series = ''; 86 if( isset( $period_start ) && isset( $period_stop ) ) 102 103 if( ( $archive ) && ( isset( $period_start ) && isset( $period_stop ) ) ) 87 104 { 88 105 $rrd_dirs = $trd->getRrdDirs( $period_start, $period_stop ); 106 } 107 else 108 { 109 $rrd_dirs = array( "$rrds/$clustername/$hostname" ); 89 110 } 90 111 … … 365 386 foreach( $rrd_dirs as $rrd_dir ) { 366 387 367 if( $def_nr == 0 ) { 368 $title_str = ":'${subtitle}'"; 369 } else { 388 if( $def_nr == 0 ) 389 { 390 if( $archive ) 391 { 392 $title_str = ":'${subtitle}'"; 393 } 394 else 395 { 396 $title_str = ":'${subtitle} (now $value)'"; 397 } 398 } 399 else 400 { 370 401 $title_str = ""; 371 402 } … … 387 418 } 388 419 389 //$title = "$hostname $style $metricname";390 420 $title = "$hostname"; 391 421 392 //# Set the graph title. 393 //if($context == "meta") { 394 // $title = "$self $meta_designator $style last $range"; 395 //} else if ($context == "grid") { 396 // $title = "$grid $meta_designator $style last $range"; 397 //} else if ($context == "cluster") { 398 // $title = "$clustername $style last $range"; 399 //} else { 400 // if ($size == "small") { 401 // # Value for this graph define a background color. 402 // if (!$load_color) $load_color = "ffffff"; 403 // $background = "--color BACK#'$load_color'"; 404 405 // $title = $hostname; 406 // } else { 407 // if ($style) 408 // $title = "$hostname $style last $range"; 409 // else 410 // $title = $metricname; 411 // } 412 //} 422 if( !$load_color ) 423 { 424 $load_color = "ffffff"; 425 } 426 427 $background = "--color BACK#'$load_color'"; 413 428 414 429 function determineXGrid( $p_start, $p_stop ) { … … 494 509 495 510 # Calculate time range. 496 if( isset($sourcetime) )497 {511 //if( isset($sourcetime) ) 512 //{ 498 513 //printf("yay"); 499 514 500 $end = $sourcetime;501 # Get_context makes start negative.502 $start = $sourcetime + $start;503 504 # Fix from Phil Radden, but step is not always 15 anymore.505 if ($range=="month")506 $end = floor($end / 672) * 672;507 508 $command = RRDTOOL . " graph - --start $start --end $end ".509 "--width $width --height $height $lower_limit ".510 "--title '$title' $extras $background ".511 $series;512 }515 // $end = $sourcetime; 516 // # Get_context makes start negative. 517 // $start = $sourcetime + $start; 518 519 // # Fix from Phil Radden, but step is not always 15 anymore. 520 // if ($range=="month") 521 // $end = floor($end / 672) * 672; 522 523 // $command = RRDTOOL . " graph - --start $start --end $end ". 524 // "--width $width --height $height $lower_limit ". 525 // "--title '$title' $extras $background ". 526 // $series; 527 //} 513 528 514 529 # … … 520 535 # $series; 521 536 522 else {537 //else { 523 538 $command = RRDTOOL . " graph - --start $period_start --end $period_stop ". 524 539 "--width $width --height $height $lower_limit ". 525 540 "--title '$title' $extras $background ". 526 541 $series; 527 }542 //} 528 543 529 544 $debug=0; 530 545 531 546 # Did we generate a command? Run it. 532 if($command) { 547 if( $command ) 548 { 533 549 /*Make sure the image is not cached*/ 534 550 header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past -
trunk/web2/addons/job_monarch/jobstore.php
r603 r604 489 489 $load_color = load_color($load); 490 490 491 $reported = (int) $jobs[$jid]['reported']; 492 493 $time = time(); 491 494 492 495 // RB: something broken here with JR / JS 493 496 // 494 //$job_runtime = intval( $jobs[$jid]['reported'] )- intval( $jobs[$jid]['start_timestamp'] );495 $job_runtime = date( 'u' ) - intval( $jobs[$jid]['start_timestamp'] );496 $job_window = intval( $job_runtime ) * 1.2;497 $job_runtime = $time - intval( $jobs[$jid]['start_timestamp'] ); 498 //$job_runtime = date( 'u' ) - intval( $jobs[$jid]['start_timestamp'] ); 499 //$job_window = intval( $job_runtime ) * 1.2; 497 500 498 501 $jobrange = -$job_window; 499 $jobstart = $jobs[$jid]['start_timestamp']; 502 $jobstart = (int) $jobs[$jid]['start_timestamp']; 503 $period_start = (int) ($time - (($time - $jobstart) * 1.1 )); 500 504 501 505 $nr['jid'] = $jid; … … 515 519 // maybe later to popup? 516 520 // 517 //$host_link = "\"../../?c=$cluster_url&h=$host_url&r=job&jr=$jobrange&j s=$jobstart\"";521 //$host_link = "\"../../?c=$cluster_url&h=$host_url&r=job&jr=$jobrange&job_start=$jobstart\""; 518 522 519 523 if ( $val["TYPE"] == "timestamp" || $always_timestamp[$metricname] ) … … 527 531 else 528 532 { 533 $end = time(); 529 534 $graphargs = ($reports[$metricname]) ? "g=$metricname&" : "m=$metricname&"; 530 $graphargs .= "c=$cluster_url&h=$host_url&l=$load_color&v=".$val['VAL']."&r=job& jr=$jobrange&js=$jobstart";535 $graphargs .= "c=$cluster_url&h=$host_url&l=$load_color&v=".$val['VAL']."&r=job&period_start=$period_start&period_stop=$end&job_start=$jobstart"; 531 536 532 537 if( $max > 0 ) -
trunk/web2/addons/job_monarch/js/monarch.js
r602 r604 829 829 proxy: JobProxy, 830 830 autoLoad: false, 831 // RB: anto cache store timestamp, dan autoload 831 832 baseParams: { task: "GETMETRICS" }, 832 833 reader: … … 923 924 new Ext.XTemplate( 924 925 '<tpl for=".">', 925 '<div class="rrd-float"><a href=". ./../graph.php?z=large&{ga}" border="0" rel="lightbox[{jid}.{[globalWindowCount]}]"><img src="../../graph.php?z=small&{ga}" border="0"></a></div>',926 '<div class="rrd-float"><a href="./graph.php?z=large&{ga}" border="0" rel="lightbox[{jid}.{[globalWindowCount]}]"><img src="./graph.php?z=small&{ga}" border="0"></a></div>', 926 927 '</tpl>' 927 928 ) … … 967 968 xtype: 'combo', 968 969 width: 190, 970 myview: view, 969 971 listeners: 970 972 { … … 976 978 // doe iets 977 979 980 //this.myview.getStore().baseParams.metricname = metric; 981 //this.myview.refresh(); 978 982 // RB: misschien zo metric opgeven aan datastore? 979 983 //items[0].items[0].getStore().baseParams.metric = metric;
Note: See TracChangeset
for help on using the changeset viewer.