mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix lldp discovery code, small fix, addhost fix
git-svn-id: http://www.observium.org/svn/observer/trunk@1547 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+3
-2
@@ -15,14 +15,15 @@ if($argv[1]) {
|
||||
$port = 161;
|
||||
|
||||
if (!$snmpver) $snmpver = "v2c";
|
||||
if (!$community) $community = $config['snmp']['community'][0];
|
||||
if ($community) { unset($config['snmp']['community']); $config['snmp']['community'][] = $community; }
|
||||
|
||||
list($hostshort) = explode(".", $host);
|
||||
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)) {
|
||||
$snmphost = trim(str_replace("\"", "", shell_exec($config['snmpget'] ." -m SNMPv2-MIB -Oqv -$snmpver -c $community $host:$port sysName.0")));
|
||||
# FIXME should be a foreach $config['snmp']['community'][0] as $community
|
||||
$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);
|
||||
if($return) { echo($return . "\n"); } else { echo("Adding $host failed\n"); }
|
||||
|
||||
Reference in New Issue
Block a user