From 350b57bb799a36647d97a3c9bb18a1fce59dca88 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Wed, 16 Mar 2011 14:23:38 +0000 Subject: [PATCH] fix to actually make community parameter optional again git-svn-id: http://www.observium.org/svn/observer/trunk@1874 61d68cd4-352d-0410-923a-c4978735b2b8 --- addhost.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addhost.php b/addhost.php index 58ac184c76..82082afeb6 100755 --- a/addhost.php +++ b/addhost.php @@ -30,14 +30,13 @@ if (isset($argv[1]) && $argv[1]) } if (!$snmpver) $snmpver = "v2c"; + if ($community) { unset($config['snmp']['community']); $config['snmp']['community'][] = $community; } - $device = deviceArray($host, $community, $snmpver, $port, $transport); - list($hostshort) = explode(".", $host); if (mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `hostname` = '".mres($host)."'"), 0) == '0' ) { @@ -47,6 +46,9 @@ if (isset($argv[1]) && $argv[1]) { # FIXME should be a foreach $config['snmp']['community'][0] as $community $community = $config['snmp']['community'][0]; + + $device = deviceArray($host, $community, $snmpver, $port, $transport); + if (isSNMPable($device)) { $snmphost = snmp_get($device, "sysName.0", "-Oqv", "SNMPv2-MIB");