diff --git a/addhost.php b/addhost.php index 8db38b56a9..d6de321729 100755 --- a/addhost.php +++ b/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))) diff --git a/includes/functions.php b/includes/functions.php index ba9ce08956..741b3cadff 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -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)