mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Reconstruct addHost() so it is easier to understand
Update addHost() to return either device_id or a string modify print_error(), print_message() to allow for $quiet variable Only call addHost() once in addhost.php, if the snmp version isn't set, addHost will cope Fix up snmp-scan.php and discovery-protocols.inc.php to detect when a device already exists change in ip_exists() to make it more readable
This commit is contained in:
@ -290,13 +290,13 @@ function add_device() {
|
||||
}
|
||||
if (empty($message)) {
|
||||
$result = addHost($hostname, $snmpver, $port, $transport, 1, $poller_group, $force_add);
|
||||
if ($result) {
|
||||
if (is_numeric($result)) {
|
||||
$code = 201;
|
||||
$status = 'ok';
|
||||
$message = "Device $hostname has been added successfully";
|
||||
}
|
||||
else {
|
||||
$message = "Failed adding $hostname";
|
||||
$message = $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user