fix to actually make community parameter optional again

git-svn-id: http://www.observium.org/svn/observer/trunk@1874 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-03-16 14:23:38 +00:00
parent 31cfad371f
commit 350b57bb79

View File

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