mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix interfaces discovery
git-svn-id: http://www.observium.org/svn/observer/trunk@207 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
|
||||
echo("Interfaces : ");
|
||||
|
||||
# $cmd = $config['snmpwalk'] . " -O nsq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] . " .1.3.6.1.2.1.2.2.1.2 | sed s/ifDescr.//g | sed s/\ \"/\|\|\"/g | sed s/\ /\|\|/g";
|
||||
$cmd = $config['snmpwalk'] . " -O nsq -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] . " .1.3.6.1.2.1.2.2.1.2";
|
||||
$interfaces = trim(shell_exec($cmd));
|
||||
$interfaces = str_replace("\"", "", $interfaces);
|
||||
@@ -32,7 +31,9 @@
|
||||
if ($nullintf == 0) {
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') {
|
||||
mysql_query("INSERT INTO `interfaces` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('$id','$ifIndex','$ifName')");
|
||||
echo("+");
|
||||
echo("\n INSERT INTO `interfaces` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('".$device['device_id']."','$ifIndex','$ifName') \n ");
|
||||
# Add Interface
|
||||
echo("+" . mysql_error() . mysql_affected_rows());
|
||||
} else {
|
||||
# Interface Already Exists
|
||||
echo(".");
|
||||
|
Reference in New Issue
Block a user