add rancid config integration

git-svn-id: http://www.observium.org/svn/observer/trunk@343 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-02-04 16:18:11 +00:00
parent acfc14a887
commit 7fa663d9f5
5 changed files with 61 additions and 9 deletions

View File

@@ -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);

View File

@@ -137,6 +137,16 @@ if($config['enable_syslog']) { echo("
</li>
"); }
if($_SESSION[userlevel] >= "5" && is_file($config['rancid_configs'] . $device['hostname'])) {
echo("
<li class=" . $select['showconfig'] . ">
<a href='/device/" . $device['device_id'] . "/showconfig/'>
<img src='images/16/page_white_text.png' align=absmiddle border=0> Config
</a>
</li>
");
}
if($_SESSION[userlevel] >= "5") {
echo("
<li class=" . $select['edit'] . ">

View File

@@ -0,0 +1,16 @@
<?php
if($_SESSION[userlevel] >= "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.");
}
?>