mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
change setting to dp_autocreate (with fallback to cdp_autocreate), allowing new device discovery through discovery protocols to be disabled
git-svn-id: http://www.observium.org/svn/observer/trunk@2464 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -71,7 +71,7 @@ $config['snmp']['transports'] = array('udp', 'udp6', 'tcp', 'tcp6');
|
||||
|
||||
### Autodiscovery Settings
|
||||
|
||||
$config['cdp_autocreate'] = false; ## Autodiscover unknown hosts seen via CDP
|
||||
$config['dp_autocreate'] = false; ## Autodiscover unknown hosts seen via discovery protocols
|
||||
$config['snmp_autodiscovery'] = false; ## Autodiscover hosts on new subnets
|
||||
$config['discover_services'] = false; ## Autodiscover services via SNMP on devices of type "server"
|
||||
|
||||
|
@@ -14,25 +14,29 @@
|
||||
|
||||
function discover_new_device($hostname)
|
||||
{
|
||||
|
||||
global $config;
|
||||
|
||||
if ( isDomainResolves($hostname . "." . $config['mydomain']) ) {
|
||||
$dst_host = $hostname . "." . $config['mydomain'];
|
||||
} else {
|
||||
$dst_host = $hostname;
|
||||
}
|
||||
$ip = gethostbyname($dst_host);
|
||||
|
||||
if ( match_network($config['nets'], $ip) )
|
||||
if ($config['dp_autocreate'])
|
||||
{
|
||||
$remote_device_id = addHost ($dst_host, NULL, "v2c");
|
||||
if($remote_device_id) {
|
||||
$remote_device = device_by_id_cache($remote_device_id, 1);
|
||||
echo("+[".$remote_device['hostname']."(".$remote_device['device_id'].")]");
|
||||
discover_device($remote_device);
|
||||
$remote_device = device_by_id_cache($remote_device_id, 1);
|
||||
return $remote_device_id;
|
||||
if (isDomainResolves($hostname . "." . $config['mydomain']))
|
||||
{
|
||||
$dst_host = $hostname . "." . $config['mydomain'];
|
||||
} else {
|
||||
$dst_host = $hostname;
|
||||
}
|
||||
$ip = gethostbyname($dst_host);
|
||||
|
||||
if (match_network($config['nets'], $ip))
|
||||
{
|
||||
$remote_device_id = addHost ($dst_host, NULL, "v2c");
|
||||
if($remote_device_id)
|
||||
{
|
||||
$remote_device = device_by_id_cache($remote_device_id, 1);
|
||||
echo("+[".$remote_device['hostname']."(".$remote_device['device_id'].")]");
|
||||
discover_device($remote_device);
|
||||
$remote_device = device_by_id_cache($remote_device_id, 1);
|
||||
return $remote_device_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -946,6 +946,11 @@ if (!isset($config['log_file']))
|
||||
$config['log_file'] = $config['install_dir'] . "/observium.log";
|
||||
}
|
||||
|
||||
if (isset($config['cdp_autocreate']))
|
||||
{
|
||||
$config['dp_autocreate'] = $config['cdp_autocreate'];
|
||||
}
|
||||
|
||||
if (!isset($config['mibdir']))
|
||||
{
|
||||
$config['mibdir'] = $config['install_dir']."/mibs/";
|
||||
|
Reference in New Issue
Block a user