mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
Make addhost work correctly again after transport patch, found by jwh
git-svn-id: http://www.observium.org/svn/observer/trunk@1864 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
parent
b07db6b09f
commit
0b55624ba0
11
addhost.php
11
addhost.php
@ -20,7 +20,14 @@ if (isset($argv[1]) && $argv[1])
|
||||
$port = 161;
|
||||
}
|
||||
|
||||
$transport = $argv[5];
|
||||
if (@!$argv[5])
|
||||
{
|
||||
$transport = 'udp';
|
||||
}
|
||||
else
|
||||
{
|
||||
$transport = $argv[5];
|
||||
}
|
||||
|
||||
if (!$snmpver) $snmpver = "v2c";
|
||||
if ($community)
|
||||
@ -40,7 +47,7 @@ if (isset($argv[1]) && $argv[1])
|
||||
{
|
||||
# FIXME should be a foreach $config['snmp']['community'][0] as $community
|
||||
$community = $config['snmp']['community'][0];
|
||||
if ( isSNMPable($device))
|
||||
if (isSNMPable($device))
|
||||
{
|
||||
$snmphost = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB");
|
||||
if ($snmphost == "" || ($snmphost && ($snmphost == $host || $hostshort = $host)))
|
||||
|
@ -498,10 +498,10 @@ function fixIOSHardware($hardware)
|
||||
|
||||
}
|
||||
|
||||
function createHost ($host, $community, $snmpver, $port = 161, $proto = 'udp')
|
||||
function createHost ($host, $community, $snmpver, $port = 161, $transport = 'udp')
|
||||
{
|
||||
$host = trim(strtolower($host));
|
||||
$device = deviceArray($host, $community, $snmpver, $port, $proto);
|
||||
$device = deviceArray($host, $community, $snmpver, $port, $transport);
|
||||
$host_os = getHostOS($device);
|
||||
|
||||
if ($host_os)
|
||||
|
Loading…
Reference in New Issue
Block a user