hostadding stuff

git-svn-id: http://www.observium.org/svn/observer/trunk@187 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2008-03-22 15:18:15 +00:00
parent 18accc6541
commit f77d294b6c
2 changed files with 6 additions and 4 deletions
+2 -1
View File
@@ -14,7 +14,8 @@ if($argv[1] && $argv[2] && $argv[3]) {
if ( mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `hostname` = '$host'"), 0) == '0' ) {
$snmphost = trim(`snmpget -Oqv -$snmpver -c $community $host sysName.0 | sed s/\"//g`);
if ($snmphost == $host || $hostshort = $host) {
createHost ($host, $community, $snmpver);
$return = createHost ($host, $community, $snmpver);
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"); }