mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Updated BGP discovery code to perform autodiscovery if enabled
This commit is contained in:
@@ -93,6 +93,15 @@ if ($config['enable_bgp'])
|
||||
if (dbFetchCell("SELECT COUNT(*) from `bgpPeers` WHERE device_id = ? AND bgpPeerIdentifier = ?",array($device['device_id'], $peer['ip'])) < '1')
|
||||
{
|
||||
$add = dbInsert(array('device_id' => $device['device_id'], 'bgpPeerIdentifier' => $peer['ip'], 'bgpPeerRemoteAs' => $peer['as']), 'bgpPeers');
|
||||
if ($config['autodiscovery']['bgp'] === true) {
|
||||
$name = gethostbyaddr($peer['ip']);
|
||||
$remote_device_id = discover_new_device($name);
|
||||
if ($remote_device_id) {
|
||||
log_event("Device $name (" . $peer['ip'] .") autodiscovered through BGP on ".$device['hostname'], $remote_device_id, 'system');
|
||||
} else {
|
||||
log_event("BGP discovery of $name (" . $peer['ip'] . ") failed - check ping and SNMP access", $device['device_id'], 'system');
|
||||
}
|
||||
}
|
||||
echo("+");
|
||||
} else {
|
||||
$update = dbUpdate(array('bgpPeerRemoteAs' => $peer['as'], 'astext' => mres($astext)), 'bgpPeers', 'device_id=? AND bgpPeerIdentifier=?',array($device['device_id'],$peer['ip']));
|
||||
|
||||
Reference in New Issue
Block a user