mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 08:02:23 +02:00
recognise some new OSes, add an image for dlink, move sysObjectId polling to be global for os detection
git-svn-id: http://www.observium.org/svn/observer/trunk@1345 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+9
-7
@@ -18,17 +18,19 @@ if($argv[1]) {
|
||||
if (!$community) $community = $config['community'];
|
||||
|
||||
list($hostshort) = explode(".", $host);
|
||||
if ( isDomainResolves($argv[1])){
|
||||
if ( isPingable($argv[1])) {
|
||||
if ( mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `hostname` = '".mres($host)."'"), 0) == '0' ) {
|
||||
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")));
|
||||
if ($snmphost == "" || $snmphost && ($snmphost == $host || $hostshort = $host)) {
|
||||
if ($snmphost != "" || $snmphost && ($snmphost == $host || $hostshort = $host)) {
|
||||
$return = createHost ($host, $community, $snmpver, $port);
|
||||
if($return) { echo($return . "\n"); } else { echo("Adding $host failed\n"); }
|
||||
} else { echo("Given hostname does not match SNMP-read hostname!\n"); }
|
||||
} else { echo("Already got host $host\n"); }
|
||||
} else { echo("Could not ping $host\n"); }
|
||||
} else { echo("Could not resolve $host\n"); }
|
||||
} else { echo("Could not reach $host with SNMP\n"); }
|
||||
} else { echo("Could not ping $host\n"); }
|
||||
} else { echo("Could not resolve $host\n"); }
|
||||
} else { echo("Already got host $host\n"); }
|
||||
} else { echo("Add Host Tool\nUsage: ./addhost.php <hostname> [community] [v1|v2c] [port]\n"); }
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user