2007-04-03 14:10:23 +00:00
|
|
|
<?php
|
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
if ($_SESSION['userlevel'] < 10)
|
|
|
|
{
|
2011-03-28 10:39:55 +00:00
|
|
|
include("includes/error-no-perm.inc.php");
|
2012-04-06 13:56:23 +00:00
|
|
|
|
2011-03-17 00:09:20 +00:00
|
|
|
exit;
|
2007-06-24 14:56:47 +00:00
|
|
|
}
|
|
|
|
|
2009-03-25 14:54:21 +00:00
|
|
|
echo("<h2>Add Device</h2>");
|
2008-03-09 21:13:27 +00:00
|
|
|
|
2011-09-08 05:02:14 +00:00
|
|
|
if ($_POST['hostname'])
|
2011-03-17 00:09:20 +00:00
|
|
|
{
|
|
|
|
if ($_SESSION['userlevel'] > '5')
|
|
|
|
{
|
2008-07-22 08:24:34 +00:00
|
|
|
$hostname = mres($_POST['hostname']);
|
2011-10-05 09:32:34 +00:00
|
|
|
|
2012-05-09 16:18:23 +00:00
|
|
|
if ($_POST['snmpver'] === "v2c" or $_POST['snmpver'] === "v1")
|
2011-10-05 09:32:34 +00:00
|
|
|
{
|
2012-05-09 16:18:23 +00:00
|
|
|
if ($_POST['community'])
|
|
|
|
{
|
|
|
|
$config['snmp']['community'] = array($_POST['community']);
|
|
|
|
}
|
|
|
|
|
|
|
|
$snmpver = mres($_POST['snmpver']);
|
|
|
|
if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; }
|
|
|
|
print_message("Adding host $hostname communit" . (count($config['snmp']['community']) == 1 ? "y" : "ies") . " " . implode(', ',$config['snmp']['community']) . " port $port");
|
2011-10-05 09:32:34 +00:00
|
|
|
}
|
2012-05-09 16:18:23 +00:00
|
|
|
elseif ($_POST['snmpver'] === "v3")
|
|
|
|
{
|
|
|
|
$v3 = array (
|
|
|
|
'authlevel' => mres($_POST['authlevel']),
|
|
|
|
'authname' => mres($_POST['authname']),
|
|
|
|
'authpass' => mres($_POST['authpass']),
|
|
|
|
'authalgo' => mres($_POST['authalgo']),
|
|
|
|
'cryptopass' => mres($_POST['cryptopass']),
|
|
|
|
'cryptoalgo' => mres($_POST['cryptoalgo']),
|
|
|
|
);
|
|
|
|
|
|
|
|
array_push($config['snmp']['v3'], $v3);
|
2012-05-15 15:18:57 +00:00
|
|
|
|
2012-05-09 16:18:23 +00:00
|
|
|
$snmpver = "v3";
|
2011-10-05 09:32:34 +00:00
|
|
|
|
2012-05-09 16:18:23 +00:00
|
|
|
if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; }
|
|
|
|
print_message("Adding SNMPv3 host $hostname port $port");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
print_error("Unsupported SNMP Version. There was a dropdown menu, how did you reach this error ?");
|
|
|
|
}
|
2011-10-05 09:32:34 +00:00
|
|
|
$result = addHost($hostname, $snmpver, $port);
|
|
|
|
if ($result)
|
|
|
|
{
|
|
|
|
print_message("Device added ($result)");
|
|
|
|
}
|
2007-04-03 14:10:23 +00:00
|
|
|
} else {
|
2011-03-28 10:39:55 +00:00
|
|
|
print_error("You don't have the necessary privileges to add hosts.");
|
2007-04-03 14:10:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-18 14:41:19 +00:00
|
|
|
$pagetitle[] = "Add host";
|
|
|
|
|
2007-04-03 14:10:23 +00:00
|
|
|
?>
|
|
|
|
|
2011-03-30 16:28:24 +00:00
|
|
|
<form name="form1" method="post" action="">
|
2008-03-09 21:13:27 +00:00
|
|
|
<p>Devices will be checked for Ping and SNMP reachability before being probed. Only devices with recognised OSes will be added.</p>
|
|
|
|
|
2011-03-27 10:21:19 +00:00
|
|
|
<div style="padding: 10px; background: #f0f0f0;">
|
|
|
|
<table cellpadding=2px>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Hostname</strong></td>
|
|
|
|
<td><input type="text" name="hostname" size="32"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>SNMP Version</strong></td>
|
|
|
|
<td>
|
|
|
|
<select name="snmpver">
|
|
|
|
<option value="v1">v1</option>
|
|
|
|
<option value="v2c" selected>v2c</option>
|
2012-05-09 16:18:23 +00:00
|
|
|
<option value="v3">v3</option>
|
2011-03-27 10:21:19 +00:00
|
|
|
</select>
|
|
|
|
<strong>Port</strong> <input type="text" name="port" size="16">
|
|
|
|
</td>
|
|
|
|
</tr>
|
2012-05-09 16:18:23 +00:00
|
|
|
<tr>
|
|
|
|
<td colspan=2><strong>SNMPv1/2c Configuration</strong></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Community</strong></td>
|
|
|
|
<td><input type="text" name="community" size="32"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td colspan=2><strong>SNMPv3 Configuration</strong></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Auth Level</strong></td>
|
|
|
|
<td>
|
|
|
|
<select name="authlevel">
|
|
|
|
<option value="noAuthNoPriv" selected>NoAuthNoPriv</option>
|
|
|
|
<option value="authNoPriv">AuthNoPriv</option>
|
|
|
|
<option value="authPriv">AuthPriv</option>
|
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Auth User Name</strong></td>
|
|
|
|
<td><input type="text" name="authname" size="32"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Auth Password</strong></td>
|
|
|
|
<td><input type="text" name="authpass" size="32"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Auth Algorithm</strong></td>
|
|
|
|
<td>
|
|
|
|
<select name="authalgo">
|
|
|
|
<option value="MD5" selected>MD5</option>
|
2012-05-16 08:03:47 +00:00
|
|
|
<option value="SHA">SHA</option>
|
2012-05-09 16:18:23 +00:00
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Crypto Password</strong></td>
|
|
|
|
<td><input type="text" name="cryptopass" size="32"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><strong>Crypto Algorithm</strong></td>
|
|
|
|
<td>
|
|
|
|
<select name="cryptoalgo">
|
|
|
|
<option value="AES" selected>AES</option>
|
|
|
|
<option value="DES">DES</option>
|
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2011-03-27 10:21:19 +00:00
|
|
|
<tr>
|
|
|
|
<td></td><td><input type="submit" class="submit" name="Submit" value="Add Host"></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
2007-04-03 14:10:23 +00:00
|
|
|
</form>
|