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,9 +71,12 @@ $config['snmp']['transports'] = array('udp', 'udp6', 'tcp', 'tcp6');
### Autodiscovery Settings ### Autodiscovery Settings
$config['dp_autocreate'] = false; ## Autodiscover unknown hosts seen via discovery protocols $config['autodiscovery']['xdp'] = true; ## Autodiscover hosts via discovery protocols
$config['snmp_autodiscovery'] = false; ## Autodiscover hosts on new subnets $config['autodiscovery']['ospf'] = true; ## Autodiscover hosts via OSPF
$config['discover_services'] = false; ## Autodiscover services via SNMP on devices of type "server" $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 ### Alerting Settings

View File

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