genericify

git-svn-id: http://www.observium.org/svn/observer/trunk@2465 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-15 15:01:21 +00:00
parent 34bf22a7e0
commit eb2951d8fc
2 changed files with 12 additions and 10 deletions

View File

@ -71,8 +71,11 @@ $config['snmp']['transports'] = array('udp', 'udp6', 'tcp', 'tcp6');
### Autodiscovery Settings
$config['dp_autocreate'] = false; ## Autodiscover unknown hosts seen via discovery protocols
$config['snmp_autodiscovery'] = false; ## Autodiscover hosts on new subnets
$config['autodiscovery']['xdp'] = true; ## Autodiscover hosts via discovery protocols
$config['autodiscovery']['ospf'] = true; ## Autodiscover hosts via OSPF
$config['autodiscovery']['bgp'] = true; ## Autodiscover hosts via BGP
$config['autodiscovery']['snmpscan'] = true; ## autodiscover hosts via SNMP scanning
$config['discover_services'] = false; ## Autodiscover services via SNMP on devices of type "server"
### Alerting Settings

View File

@ -16,10 +16,8 @@ function discover_new_device($hostname)
{
global $config;
if ($config['dp_autocreate'])
{
if (isDomainResolves($hostname . "." . $config['mydomain']))
{
if($config['autodiscovery']['xdp']) {
if ( isDomainResolves($hostname . "." . $config['mydomain']) ) {
$dst_host = $hostname . "." . $config['mydomain'];
} else {
$dst_host = $hostname;
@ -29,8 +27,7 @@ function discover_new_device($hostname)
if ( match_network($config['nets'], $ip) )
{
$remote_device_id = addHost ($dst_host, NULL, "v2c");
if($remote_device_id)
{
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);
@ -38,6 +35,8 @@ function discover_new_device($hostname)
return $remote_device_id;
}
}
} else {
return FALSE;
}
}