fix addhost that got borked a few commits back

git-svn-id: http://www.observium.org/svn/observer/trunk@1549 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans 2010-07-30 16:24:01 +00:00
parent 4696c7f02a
commit b34cb35a46

View File

@ -21,8 +21,9 @@ if($argv[1]) {
if ( mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `hostname` = '".mres($host)."'"), 0) == '0' ) {
if ( isDomainResolves($argv[1])){
if ( isPingable($argv[1])) {
if ( isSNMPable($argv[1], $community, $snmpver, $port)) {
# FIXME should be a foreach $config['snmp']['community'][0] as $community
$community = $config['snmp']['community'][0];
if ( isSNMPable($argv[1], $community, $snmpver, $port)) {
$snmphost = trim(str_replace("\"", "", shell_exec($config['snmpget'] ." -m SNMPv2-MIB -Oqv -$snmpver -c ".$config['snmp']['community'][0]." $host:$port sysName.0")));
if ($snmphost == "" || ($snmphost && ($snmphost == $host || $hostshort = $host))) {
$return = createHost ($host, $community, $snmpver, $port);