mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 00:25:06 +02:00
Updated adding devices for distributed poller
This commit is contained in:
@@ -207,6 +207,8 @@ function add_device()
|
||||
$hostname = $data['hostname'];
|
||||
$port = $data['port'] ? mres($data['port']) : $config['snmp']['port'];
|
||||
$transport = $data['transport'] ? mres($data['transport']) : "udp";
|
||||
$poller_group = $data['poller_group'] ? mres($data['poller_group']) : 0;
|
||||
$force_add = $data['force_add'] ? mres($data['force_add']) : 0;
|
||||
if($data['version'] == "v1" || $data['version'] == "v2c")
|
||||
{
|
||||
if ($data['community'])
|
||||
@@ -237,7 +239,7 @@ function add_device()
|
||||
}
|
||||
if(empty($message))
|
||||
{
|
||||
$result = addHost($hostname, $snmpver, $port, $transport, 1);
|
||||
$result = addHost($hostname, $snmpver, $port, $transport, 1, $poller_group,$force_add);
|
||||
if($result)
|
||||
{
|
||||
$code = 201;
|
||||
|
||||
@@ -51,7 +51,13 @@ if ($_POST['hostname'])
|
||||
print_error("Unsupported SNMP Version. There was a dropdown menu, how did you reach this error ?");
|
||||
}
|
||||
$poller_group = $_POST['poller_group'];
|
||||
$result = addHost($hostname, $snmpver, $port, $transport,0,$poller_group);
|
||||
$force_add = $_POST['force_add'];
|
||||
if ($force_add == 'on') {
|
||||
$force_add = 1;
|
||||
} else {
|
||||
$force_add = 0;
|
||||
}
|
||||
$result = addHost($hostname, $snmpver, $port, $transport,0,$poller_group,$force_add);
|
||||
if ($result)
|
||||
{
|
||||
print_message("Device added ($result)");
|
||||
@@ -195,6 +201,15 @@ if ($config['distributed_poller'] === TRUE) {
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-3 col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="force_add" id="force_add"> Force add
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user