mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
allow ignoring comments in rancid showconfig
git-svn-id: http://www.observium.org/svn/observer/trunk@752 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -104,6 +104,8 @@ $config['enable_pseudowires'] = 1; # Enable Pseudowires
|
||||
$config['enable_ports_etherlike'] = 0; # Enable Polling EtherLike-MIB (doubles interface processing time)
|
||||
|
||||
#$config['rancid_configs'] = '/var/lib/rancid/network/configs/';
|
||||
$config['rancid_ignorecomments'] = 0; # Ignore lines starting with #
|
||||
|
||||
#$config['collectd_dir'] = '/var/lib/collectd/rrd';
|
||||
|
||||
## If a syslog entry contails these strings it is deleted from the database
|
||||
|
||||
@@ -2,10 +2,19 @@
|
||||
|
||||
include("includes/geshi/geshi.php");
|
||||
|
||||
if($_SESSION[userlevel] >= "5" && is_file($config['rancid_configs'] . $device['hostname'])) {
|
||||
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");
|
||||
$text = fread($fh, filesize($file));
|
||||
if ($config['rancid_ignorecomments'])
|
||||
{
|
||||
$lines = split("\n",$text);
|
||||
for ($i = 0;$i < count($lines);$i++)
|
||||
{
|
||||
if ($lines[$i][0] == "#") { unset($lines[$i]); }
|
||||
}
|
||||
$text = join("\n",$lines);
|
||||
}
|
||||
$language = "ios";
|
||||
$geshi = new GeSHi($text, $language);
|
||||
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
|
||||
|
||||
Reference in New Issue
Block a user