mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add and implement option addhost_alwayscheckip.
This commit is contained in:
@@ -148,6 +148,8 @@ $config['show_services'] = 0;
|
|||||||
// Enable Services on menu
|
// Enable Services on menu
|
||||||
$config['ports_page_default'] = 'details';
|
$config['ports_page_default'] = 'details';
|
||||||
// eg "details" or "basic"
|
// eg "details" or "basic"
|
||||||
|
// Adding Host Settings
|
||||||
|
$config['addhost_alwayscheckip'] = FALSE; # TRUE - check for duplicate ips even when adding host by name. FALSE- only check when adding host by ip.
|
||||||
// SNMP Settings - Timeouts/Retries disabled as default
|
// SNMP Settings - Timeouts/Retries disabled as default
|
||||||
// $config['snmp']['timeout'] = 1; # timeout in seconds
|
// $config['snmp']['timeout'] = 1; # timeout in seconds
|
||||||
// $config['snmp']['retries'] = 5; # how many times to retry the query
|
// $config['snmp']['retries'] = 5; # how many times to retry the query
|
||||||
|
|||||||
@@ -270,7 +270,12 @@ function addHost($host, $snmpver, $port = '161', $transport = 'udp', $quiet = '0
|
|||||||
list($hostshort) = explode(".", $host);
|
list($hostshort) = explode(".", $host);
|
||||||
// Test Database Exists
|
// Test Database Exists
|
||||||
if (dbFetchCell("SELECT COUNT(*) FROM `devices` WHERE `hostname` = ?", array($host)) == '0') {
|
if (dbFetchCell("SELECT COUNT(*) FROM `devices` WHERE `hostname` = ?", array($host)) == '0') {
|
||||||
if (ip_exists($host) === false) {
|
if ($config['addhost_alwayscheckip'] === TRUE) {
|
||||||
|
$ip = gethostbyname($host);
|
||||||
|
} else {
|
||||||
|
$ip = $host;
|
||||||
|
}
|
||||||
|
if (ip_exists($ip) === false) {
|
||||||
// Test reachability
|
// Test reachability
|
||||||
if ($force_add == 1 || isPingable($host)) {
|
if ($force_add == 1 || isPingable($host)) {
|
||||||
if (empty($snmpver)) {
|
if (empty($snmpver)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user