Updated adding devices for distributed poller

This commit is contained in:
laf
2015-03-19 22:06:13 +00:00
parent a1c99a2ff4
commit ab82effa3b
5 changed files with 54 additions and 16 deletions
+3 -1
View File
@@ -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;
+16 -1
View File
@@ -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>
');
}