mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fixes from mrobbert
git-svn-id: http://www.observium.org/svn/observer/trunk@2429 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -372,7 +372,7 @@ function humanspeed($speed)
|
|||||||
|
|
||||||
function print_error($text)
|
function print_error($text)
|
||||||
{
|
{
|
||||||
echo('<div class="errorbox"><img src="/images/15/exclamation.png" align="absmiddle"> '.$text.'</div>');
|
echo('<div class="errorbox"><img src="/images/16/exclamation.png" align="absmiddle"> '.$text.'</div>');
|
||||||
}
|
}
|
||||||
|
|
||||||
function print_message($text)
|
function print_message($text)
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ if ($_SESSION['userlevel'] < 10)
|
|||||||
|
|
||||||
echo("<h2>Add Device</h2>");
|
echo("<h2>Add Device</h2>");
|
||||||
|
|
||||||
if ($_POST['hostname'] && $_POST['community'])
|
if ($_POST['hostname'])
|
||||||
{
|
{
|
||||||
if ($_SESSION['userlevel'] > '5')
|
if ($_SESSION['userlevel'] > '5')
|
||||||
{
|
{
|
||||||
$hostname = mres($_POST['hostname']);
|
$hostname = mres($_POST['hostname']);
|
||||||
$community = mres($_POST['community']);
|
if ($_POST['community']) { $community = mres($_POST['community']); } else { $community = $config['snmp']['community']; }
|
||||||
$snmpver = mres($_POST['snmpver']);
|
$snmpver = mres($_POST['snmpver']);
|
||||||
if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; }
|
if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; }
|
||||||
print_message("Adding host $hostname community $community port $port");
|
print_message("Adding host $hostname community $community port $port");
|
||||||
@@ -21,10 +21,6 @@ if ($_POST['hostname'] && $_POST['community'])
|
|||||||
} else {
|
} else {
|
||||||
print_error("You don't have the necessary privileges to add hosts.");
|
print_error("You don't have the necessary privileges to add hosts.");
|
||||||
}
|
}
|
||||||
} elseif ($_POST['hostname'] && !$_POST['community']) {
|
|
||||||
print_error("A community string is required.");
|
|
||||||
} elseif (!$_POST['hostname'] && $_POST['community']) {
|
|
||||||
print_error("A hostname is required.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -190,10 +190,10 @@ function addHost($host, $community, $snmpver, $port = 161, $transport = 'udp')
|
|||||||
if ($snmphost == $host || $hostshort = $host)
|
if ($snmphost == $host || $hostshort = $host)
|
||||||
{
|
{
|
||||||
createHost($host, $community, $snmpver, $port, $transport);
|
createHost($host, $community, $snmpver, $port, $transport);
|
||||||
} else { echo("Given hostname does not match SNMP-read hostname!\n"); }
|
} else { print_error("Given hostname does not match SNMP-read hostname!\n"); }
|
||||||
} else { echo("Already got host $host\n"); }
|
} else { print_error("Already got host $host\n"); }
|
||||||
} else { echo("Could not ping $host\n"); }
|
} else { print_error("Could not ping $host\n"); }
|
||||||
} else { echo("Could not resolve $host\n"); }
|
} else { print_error("Could not resolve $host\n"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
function scanUDP($host, $port, $timeout)
|
function scanUDP($host, $port, $timeout)
|
||||||
|
|||||||
Reference in New Issue
Block a user