improved cipsec graphs

git-svn-id: http://www.observium.org/svn/observer/trunk@1608 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong 2010-08-02 02:40:17 +00:00
parent be578edb5c
commit e2affba40c
4 changed files with 23 additions and 15 deletions

View File

@ -7,5 +7,4 @@ $rra_out = "OutOctets";
include("includes/graphs/generic_bits.inc.php");
?>

View File

@ -14,7 +14,7 @@ $colour_area_in_max = "CC88CC";
$colour_area_out_max = "FFEFAA";
$graph_max = 1;
$unit_text = "Pkts\ \ \ ";
$unit_text = "Pkts ";
include("includes/graphs/generic_duplex.inc.php");

View File

@ -1,16 +1,23 @@
<?php
include("includes/graphs/common.inc.php");
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cipsec_flow.rrd";
include("includes/graphs/common.inc.php");
$rrd_options .= " DEF:Tunnels=$rrd_filename:Tunnels:AVERAGE";
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/cipsec_flow.rrd";
$rra = "Tunnels";
$colour_area = "9999cc";
$colour_line = "0000cc";
$colour_area_max = "aaaaacc";
$scale_min = 0;
$unit_text = "Active Tunnels";
include("includes/graphs/generic_simplex.inc.php");
$rrd_options .= " COMMENT:'Tunnels Current Average Maximum\\n'";
$rrd_options .= " LINE1.25:Tunnels#660000:'Active Tunnels'";
$rrd_options .= " GPRINT:Tunnels:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:Tunnels:AVERAGE:\ %6.2lf%s";
$rrd_options .= " GPRINT:Tunnels:MAX:\ %6.2lf%s\\\\n";
?>

View File

@ -72,13 +72,15 @@ if(is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.ph
if($auth) {
include($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php");
}
} else {
graph_error("Graph Template Missing");
}
function graph_error ($string) {
global $width, $height;
header('Content-type: image/png');
$im = imagecreate($width+75, $height);
$orange = imagecolorallocate($im, 255, 255, 255);
$im = imagecreate($width+79, $height);
$orange = imagecolorallocate($im, 255, 225, 225);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
imagepng($im);
@ -86,8 +88,10 @@ function graph_error ($string) {
}
if($auth)
if(!$auth)
{
graph_error("Unauthorized");
} else {
if($no_file)
{
graph_error("Missing RRD");
@ -112,8 +116,6 @@ if($auth)
graph_error("Definition Error");
}
}
} else {
graph_error("Unauthorized");
}