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:
Tom Laermans 2011-03-16 01:05:02 +00:00
parent b07db6b09f
commit 0b55624ba0
2 changed files with 11 additions and 4 deletions

View File

@ -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)))

View File

@ -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)