Skip to content

Commit

Permalink
This commit is a merge from trunk -> branches/monitor-core-3.1:
Browse files Browse the repository at this point in the history
 svn merge -c1448 https://ganglia.svn.sourceforge.net/svnroot/ganglia/trunk/monitor-core .

Original commit message:

[web] Revert graphs' title and subtitle behaviour back to pre-modular graph.php patch (3.0.x) with one enhancement: the subtitle "$metricname last $range (now $now)" is no longer clobbered and is split into two lines (tested with rrdtool 1.2.23)

Reviewed-by: Brad Nicholes <BNICHOLES@novell.com>
Reviewed-by: Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
  • Loading branch information
bernardli committed Jun 24, 2008
1 parent 97060e3 commit 1e5f27e
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 14 deletions.
9 changes: 8 additions & 1 deletion web/graph.d/cpu_report.php
Expand Up @@ -11,11 +11,18 @@ function graph_cpu_report ( &$rrdtool_graph ) {
$cpu_user_color,
$cpu_wio_color,
$hostname,
$range,
$rrd_dir,
$size;

$rrdtool_graph['height'] += $size == 'medium' ? 14 : 0 ;
$rrdtool_graph['title'] = 'CPU';
$title = 'CPU';
if ($context != 'host') {
$rrdtool_graph['title'] = $title;
} else {
$rrdtool_graph['title'] = "$hostname $title last $range";

}
$rrdtool_graph['upper-limit'] = '100';
$rrdtool_graph['lower-limit'] = '0';
$rrdtool_graph['vertical-label'] = 'Percent';
Expand Down
10 changes: 8 additions & 2 deletions web/graph.d/load_report.php
Expand Up @@ -10,12 +10,18 @@ function graph_load_report ( &$rrdtool_graph ) {
$hostname,
$load_one_color,
$num_nodes_color,
$proc_run_color,
$proc_run_color,
$range,
$rrd_dir,
$size;

$rrdtool_graph['height'] += $size == 'medium' ? 28 : 0 ;
$rrdtool_graph['title'] = 'Load';
$title = 'Load';
if ($context != 'host') {
$rrdtool_graph['title'] = $title;
} else {
$rrdtool_graph['title'] = "$hostname $title last $range";
}
$rrdtool_graph['lower-limit'] = '0';
$rrdtool_graph['vertical-label'] = 'Load/Procs';
$rrdtool_graph['extras'] = '--rigid';
Expand Down
10 changes: 8 additions & 2 deletions web/graph.d/mem_report.php
Expand Up @@ -12,10 +12,16 @@ function graph_mem_report ( &$rrdtool_graph ) {
$mem_swapped_color,
$mem_used_color,
$cpu_num_color,
$range,
$rrd_dir,
$size;

$rrdtool_graph['title'] = 'Memory';

$title = 'Memory';
if ($context != 'host') {
$rrdtool_graph['title'] = $title;
} else {
$rrdtool_graph['title'] = "$hostname $title last $range";
}
$rrdtool_graph['lower-limit'] = '0';
$rrdtool_graph['vertical-label'] = 'Bytes';
$rrdtool_graph['extras'] = '--rigid --base 1024';
Expand Down
10 changes: 8 additions & 2 deletions web/graph.d/metric.php
Expand Up @@ -50,7 +50,12 @@ function graph_metric ( &$rrdtool_graph ) {
$hrs = intval (-$jobrange / 3600);
$subtitle = "$prefix last ${hrs} (now $value)";
} else {
$subtitle = "$metricname (now $value)";
if ($summary) {
$subtitle_one = "$metricname last $range";
} else {
$subtitle_one = "$hostname last $range";
}
$subtitle_two = " (now $value)";
}

break;
Expand Down Expand Up @@ -117,7 +122,8 @@ function graph_metric ( &$rrdtool_graph ) {

//# the actual graph...
$series = "DEF:'sum'='$rrd_dir/$metricname.rrd:sum':AVERAGE ";
$series .= "AREA:'sum'#$default_metric_color:'$subtitle' ";
$series .= "AREA:'sum'#$default_metric_color:'$subtitle_one'";
$series .= ":STACK: COMMENT:'$subtitle_two'";

if ($jobstart) {
$series .= "VRULE:$jobstart#$jobstart_color ";
Expand Down
10 changes: 8 additions & 2 deletions web/graph.d/network_report.php
Expand Up @@ -9,11 +9,17 @@ function graph_network_report ( &$rrdtool_graph ) {
$mem_cached_color,
$mem_used_color,
$cpu_num_color,
$range,
$rrd_dir,
$size;


$title = 'Network';
$rrdtool_graph['height'] += $size == 'medium' ? 28 : 0 ;
$rrdtool_graph['title'] = 'Network';
if ($context != 'host') {
$rrdtool_graph['title'] = $title;
} else {
$rrdtool_graph['title'] = "$hostname Network last $range";
}
$rrdtool_graph['lower-limit'] = '0';
$rrdtool_graph['vertical-label'] = 'Bytes/sec';
$rrdtool_graph['extras'] = '--rigid --base 1024';
Expand Down
10 changes: 8 additions & 2 deletions web/graph.d/packet_report.php
Expand Up @@ -9,11 +9,17 @@ function graph_packet_report ( &$rrdtool_graph ) {
$mem_cached_color,
$mem_used_color,
$cpu_num_color,
$range,
$rrd_dir,
$size;


$title = 'Packets';
$rrdtool_graph['height'] += $size == 'medium' ? 28 : 0 ;
$rrdtool_graph['title'] = 'Packets';
if ($context != 'host') {
$rrdtool_graph['title'] = $title;
} else {
$rrdtool_graph['title'] = "$hostname $title last $range";
}
$rrdtool_graph['lower-limit'] = '0';
$rrdtool_graph['vertical-label'] = 'Packets/sec';
$rrdtool_graph['extras'] = '--rigid --base 1024';
Expand Down
8 changes: 7 additions & 1 deletion web/graph.d/sample_report.php
Expand Up @@ -69,15 +69,21 @@ function graph_sample_report ( &$rrdtool_graph ) {
$cpu_user_color,
$cpu_wio_color,
$hostname,
$range,
$rrd_dir,
$size;
//
// You *MUST* set at least the 'title', 'vertical-label', and 'series' variables.
// Otherwise, the graph *will not work*.
//
$rrdtool_graph['title'] = 'Sample CPU Report';
$title = 'Sample CPU Report';
if ($context != 'host') {
$rrdtool_graph['title'] = $title;
// This will be turned into:
// "Clustername $TITLE last $timerange", so keep it short
} else {
$rrdtool_graph['title'] = "$hostname $title last $range";
}
$rrdtool_graph['vertical-label'] = 'Sample Percent';
$rrdtool_graph['height'] += $size == 'medium' ? 28 : 0 ; // Fudge to account for number of lines in the chart legend
$rrdtool_graph['upper-limit'] = '100';
Expand Down
6 changes: 4 additions & 2 deletions web/graph.php
Expand Up @@ -163,15 +163,17 @@

case 'host':
if (!$summary)
$title = isset($graph) ? $hostname : null ;
$title = null ;
break;

default:
$title = $clustername;
break;
}

$rrdtool_graph['title'] = $rrdtool_graph['title'] . " last $range";
if ($context != 'host') {
$rrdtool_graph['title'] = $rrdtool_graph['title'] . " last $range";
}

if (isset($title)) {
$rrdtool_graph['title'] = "$title " . $rrdtool_graph['title'];
Expand Down

0 comments on commit 1e5f27e

Please sign in to comment.