diff --git a/config.php.default b/config.php.default
index 28940c6a9c..027d587547 100755
--- a/config.php.default
+++ b/config.php.default
@@ -76,6 +76,8 @@ $config['enable_syslog'] = 1; # Enable Syslog
$config['enable_billing'] = 1; # Enable BGP session collection and display
$config['enable_inventory'] = 1; # Enable Inventory
+## Uncomment this to enable display of rancid-collected configs
+#$config['rancid_configs'] = '/var/lib/rancid/network/configs/';
## If a syslog entry contails these strings it is deleted from the database
$config['syslog_filter'] = array("last message repeated", "Connection from UDP: [127.0.0.1]:");
diff --git a/html/graph.php b/html/graph.php
index 156c206a11..c796a00798 100644
--- a/html/graph.php
+++ b/html/graph.php
@@ -26,6 +26,12 @@
$device_id = getpeerhost($_GET['peer']);
}
+ if($_GET['legend']) {
+ $legend = $_GET['legend'];
+ }
+ if($_GET['inverse']) {
+ $inverse = $_GET['inverse'];
+ }
if($device_id) {
$hostname = gethostbyid($device_id);
@@ -63,7 +69,7 @@
$graph = graph_netscreen_memory ($hostname . "/netscreen-memory.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'multi_bits':
- $graph = graph_multi_bits ($_GET['interfaces'], $graphfile, $from, $to, $width, $height);
+ $graph = graph_multi_bits ($_GET['interfaces'], $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
break;
case 'adsl_rate':
$graph = graph_adsl_rate ($hostname. "/adsl-4.rrd", $graphfile, $from, $to, $width, $height);
@@ -87,7 +93,7 @@
$graph = graph_device_bits ($device_id, $graphfile, $from, $to, $width, $height, $title, $vertical);
break;
case 'bits':
- $graph = trafgraph ($hostname . "/". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
+ $graph = graph_bits ($hostname . "/". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical, $inverse, $legend);
break;
case 'pkts':
$graph = pktsgraph ($hostname . "/". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
diff --git a/html/pages/device.php b/html/pages/device.php
index 06377d660a..0d446c435a 100644
--- a/html/pages/device.php
+++ b/html/pages/device.php
@@ -137,6 +137,16 @@ if($config['enable_syslog']) { echo("
"); }
+if($_SESSION[userlevel] >= "5" && is_file($config['rancid_configs'] . $device['hostname'])) {
+ echo("
+
+
+
Config
+
+
+");
+}
+
if($_SESSION[userlevel] >= "5") {
echo("
diff --git a/html/pages/device/showconfig.inc.php b/html/pages/device/showconfig.inc.php
new file mode 100644
index 0000000000..a7eb6dd623
--- /dev/null
+++ b/html/pages/device/showconfig.inc.php
@@ -0,0 +1,16 @@
+= "5" && is_file($config['rancid_configs'] . $device['hostname'])) {
+
+ $file = $config['rancid_configs'] . $device['hostname'];
+ $fh = fopen($file, 'r') or die("Can't open file");
+ echo(highlight_string(fread($fh, filesize($file))));
+ fclose($fh);
+
+} else {
+
+ print_error("Error : Insufficient access.");
+
+}
+
+?>
diff --git a/includes/graphing.php b/includes/graphing.php
index c93b0589ea..0325c85e45 100644
--- a/includes/graphing.php
+++ b/includes/graphing.php
@@ -5,7 +5,7 @@ include("graphing/fortigate.php");
include("graphing/windows.php");
include("graphing/unix.php");
-function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height, $legend = '0') {
+function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '0') {
global $config, $installdir;
$imgfile = "graphs/" . "$graph";
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height";
@@ -25,12 +25,16 @@ function graph_multi_bits ($interfaces, $graph, $from, $to, $width, $height, $le
$i++;
}
}
- $options .= " CDEF:inoctets=" . $in_thing . $pluses;
- $options .= " CDEF:outoctets=" . $out_thing . $pluses;
+
+ if($inverse) { $in = 'out'; $out = 'in'; } else { $in = 'in'; $out = 'out'; }
+
+ $options .= " CDEF:".$in."octets=" . $in_thing . $pluses;
+ $options .= " CDEF:".$out."octets=" . $out_thing . $pluses;
$options .= " CDEF:doutoctets=outoctets,-1,*";
$options .= " CDEF:inbits=inoctets,8,*";
$options .= " CDEF:outbits=outoctets,8,*";
$options .= " CDEF:doutbits=doutoctets,8,*";
+
if($legend) {
$options .= " AREA:inbits#CDEB8B:";
$options .= " COMMENT:BPS\ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Max\\\\n";
@@ -118,7 +122,7 @@ function temp_graph_dev ($device, $graph, $from, $to, $width, $height, $title, $
return $imgfile;
}
-function graph_device_bits ($device, $graph, $from, $to, $width, $height) {
+function graph_device_bits ($device, $graph, $from, $to, $width, $height, $title, $vertical, $inverse, $legend = '1') {
global $config, $installdir;
$imgfile = "graphs/" . "$graph";
$options = "--alt-autoscale-max -E --start $from --end " . ($to - 150) . " --width $width --height $height ";
@@ -254,7 +258,7 @@ function graph_mac_acc_interface ($interface, $graph, $from, $to, $width, $heigh
}
-function trafgraph ($rrd, $graph, $from, $to, $width, $height) {
+function graph_bits ($rrd, $graph, $from, $to, $width, $height, $title, $vertical, $inverse = '0', $legend = '1') {
global $config, $installdir;
$database = $config['rrd_dir'] . "/" . $rrd;
$imgfile = "graphs/" . "$graph";
@@ -262,8 +266,13 @@ function trafgraph ($rrd, $graph, $from, $to, $width, $height) {
$options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height ";
if($height < "33") { $options .= " --only-graph"; }
if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; }
- $options .= " DEF:inoctets=$database:INOCTETS:AVERAGE";
- $options .= " DEF:outoctets=$database:OUTOCTETS:AVERAGE";
+ if($inverse) {
+ $options .= " DEF:inoctets=$database:OUTOCTETS:AVERAGE";
+ $options .= " DEF:outoctets=$database:INOCTETS:AVERAGE";
+ } else {
+ $options .= " DEF:inoctets=$database:INOCTETS:AVERAGE";
+ $options .= " DEF:outoctets=$database:OUTOCTETS:AVERAGE";
+ }
$options .= " CDEF:octets=inoctets,outoctets,+";
$options .= " CDEF:doutoctets=outoctets,-1,*";
$options .= " CDEF:inbits=inoctets,8,*";
@@ -275,6 +284,7 @@ function trafgraph ($rrd, $graph, $from, $to, $width, $height) {
$options .= " VDEF:95thin=inbits,95,PERCENT";
$options .= " VDEF:95thout=outbits,95,PERCENT";
$options .= " VDEF:d95thout=doutbits,5,PERCENT";
+ if ($legend) {
$options .= " AREA:inbits#CDEB8B:";
$options .= " COMMENT:BPS\ \ \ \ Current\ \ \ Average\ \ \ \ \ \ Max\ \ \ 95th\ %\\\\n";
$options .= " LINE1.25:inbits#006600:In\ ";
@@ -293,6 +303,14 @@ function trafgraph ($rrd, $graph, $from, $to, $width, $height) {
$options .= " GPRINT:totout:Out\ %6.2lf%s\)\\\\l";
$options .= " LINE1:95thin#aa0000";
$options .= " LINE1:d95thout#aa0000";
+ } else {
+ $options .= " AREA:inbits#CDEB8B";
+ $options .= " LINE1.25:inbits#006600";
+ $options .= " AREA:doutbits#C3D9FF";
+ $options .= " LINE1.25:doutbits#000099";
+ $options .= " LINE1:95thin#aa0000";
+ $options .= " LINE1:d95thout#aa0000";
+ }
$thing = shell_exec($config['rrdtool'] . " graph $imgfile $options");
return $imgfile;
}