Changeset 604 for trunk/web2/addons/job_monarch/graph.php
- Timestamp:
- 02/17/09 15:57:35 (15 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.