fix apache graph. allow custom colours passed to generic_multi_simplex_seperated

git-svn-id: http://www.observium.org/svn/observer/trunk@2533 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-21 10:53:08 +00:00
parent 242c749330
commit 86c6a817ad
2 changed files with 41 additions and 59 deletions

View File

@@ -4,63 +4,40 @@ $scale_min = 0;
include("includes/graphs/common.inc.php");
$apache_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-apache-".$app['app_id'].".rrd";
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-apache-".$app['app_id'].".rrd";
if (is_file($apache_rrd))
$array = array('sb_reading' => array('descr' => 'Reading', 'colour' => '750F7DFF'),
'sb_writing' => array('descr' => 'Writing', 'colour' => '00FF00FF'),
'sb_wait' => array('descr' => 'Waiting', 'colour' => '4444FFFF'),
'sb_start' => array('descr' => 'Starting', 'colour' => '157419FF'),
'sb_keepalive' => array('descr' => 'Keepalive', 'colour' => 'FF0000FF'),
'sb_dns' => array('descr' => 'DNS', 'colour' => '6DC8FEFF'),
'sb_closing' => array('descr' => 'Closing', 'colour' => 'FFAB00FF'),
'sb_logging' => array('descr' => 'Logging', 'colour' => 'FFFF00FF'),
'sb_graceful' => array('descr' => 'Graceful', 'colour' => 'FF5576FF'),
'sb_idle' => array('descr' => 'Idle', 'colour' => 'FF4105FF'),
);
$i = 0;
if (is_file($rrd_filename))
{
$rrd_filename = $apache_rrd;
}
foreach ($array as $ds => $vars)
{
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['rra'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
} else { echo("file missing: $file"); }
$colours = "mixed";
$nototal = 1;
$unit_text = "Workers";
include("includes/graphs/generic_multi_simplex_seperated.inc.php");
$rrd_options .= ' DEF:a='.$rrd_filename.':sb_wait:AVERAGE ';
$rrd_options .= 'DEF:b='.$rrd_filename.':sb_start:AVERAGE ';
$rrd_options .= 'DEF:c='.$rrd_filename.':sb_reading:AVERAGE ';
$rrd_options .= 'DEF:d='.$rrd_filename.':sb_writing:AVERAGE ';
$rrd_options .= 'DEF:e='.$rrd_filename.':sb_keepalive:AVERAGE ';
$rrd_options .= 'DEF:f='.$rrd_filename.':sb_dns:AVERAGE ';
$rrd_options .= 'DEF:g='.$rrd_filename.':sb_closing:AVERAGE ';
$rrd_options .= 'DEF:h='.$rrd_filename.':sb_logging:AVERAGE ';
$rrd_options .= 'DEF:i='.$rrd_filename.':sb_graceful:AVERAGE ';
$rrd_options .= 'DEF:j='.$rrd_filename.':sb_idle:AVERAGE ';
$rrd_options .= 'COMMENT:"Scoreboard Current Average Maximum\n" ';
$rrd_options .= 'AREA:a#4444FFFF:"Waiting " ';
$rrd_options .= 'GPRINT:a:LAST:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:a:AVERAGE:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:a:MAX:"%6.2lf %s\n" ';
$rrd_options .= 'AREA:b#FF0000FF:"Keepalive ":STACK ';
$rrd_options .= 'GPRINT:b:LAST:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:b:AVERAGE:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:b:MAX:"%6.2lf %s\n" ';
$rrd_options .= 'AREA:c#750F7DFF:"Reading ":STACK ';
$rrd_options .= 'GPRINT:c:LAST:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:c:AVERAGE:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:c:MAX:"%6.2lf %s\n" ';
$rrd_options .= 'AREA:d#00FF00FF:"Sending ":STACK ';
$rrd_options .= 'GPRINT:d:LAST:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:d:AVERAGE":%6.2lf %s" ';
$rrd_options .= 'GPRINT:d:MAX:"%6.2lf %s\n" ';
$rrd_options .= 'AREA:e#157419FF:"Starting ":STACK ';
$rrd_options .= 'GPRINT:e:LAST:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:e:AVERAGE:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:e:MAX:"%6.2lf %s\n" ';
$rrd_options .= 'AREA:f#6DC8FEFF:"DNS Lookup":STACK ';
$rrd_options .= 'GPRINT:f:LAST:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:f:AVERAGE:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:f:MAX:"%6.2lf %s\n" ';
$rrd_options .= 'AREA:g#FFAB00FF:"Closing ":STACK ';
$rrd_options .= 'GPRINT:g:LAST:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:g:AVERAGE:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:g:MAX:"%6.2lf %s\n" ';
$rrd_options .= 'AREA:h#FFFF00FF:"Logging ":STACK ';
$rrd_options .= 'GPRINT:h:LAST:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:h:AVERAGE:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:h:MAX:"%6.2lf %s\n" ';
$rrd_options .= 'AREA:i#FF5576FF:"Graceful ":STACK ';
$rrd_options .= 'GPRINT:i:LAST:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:i:AVERAGE:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:i:MAX:"%6.2lf %s\n" ';
$rrd_options .= 'AREA:j#FF4105FF:"Idle ":STACK ';
$rrd_options .= 'GPRINT:j:LAST:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:j:AVERAGE:"%6.2lf %s" ';
$rrd_options .= 'GPRINT:j:MAX:"%6.2lf %s\n"';
?>

View File

@@ -2,7 +2,6 @@
include("includes/graphs/common.inc.php");
$descrlen = "18";
$unitlen = "10";
if($nototal) { $descrlen += "2"; $unitlen += "2";}
@@ -15,11 +14,17 @@ $rrd_options .= " COMMENT:'\\n'";
$colour_iter=0;
foreach ($rrd_list as $i => $rrd)
{
if (!$config['graph_colours'][$colours][$colour_iter]) { $colour_iter = 0; }
$colour = $config['graph_colours'][$colours][$colour_iter];
$colour_iter++;
if($rrd['colour'])
{
$colour = $rrd['colour'];
} else {
if (!$config['graph_colours'][$colours][$colour_iter]) { $colour_iter = 0; }
$colour = $config['graph_colours'][$colours][$colour_iter];
$colour_iter++;
}
$rrd_options .= " DEF:".$rrd['rra'].$i."=".$rrd['filename'].":".$rrd['rra'].":AVERAGE ";
$rrd_options .= " DEF:".$rrd['rra'].$i."min=".$rrd['filename'].":".$rrd['rra'].":MIN ";
$rrd_options .= " DEF:".$rrd['rra'].$i."max=".$rrd['filename'].":".$rrd['rra'].":MAX ";
## Suppress totalling?