a billion changes. **** MAKE SURE TO UPDATE DATABASE AND RUN poll-os.php AND discovery.php -h all **** This is VERY important, as a lot of things have changed! Expect missing files, and another update soon!

git-svn-id: http://www.observium.org/svn/observer/trunk@531 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-11-28 09:48:23 +00:00
parent bea6a0667f
commit 7157ec5549
72 changed files with 842 additions and 498 deletions

View File

@@ -109,9 +109,9 @@ function device_array($device_id) {
return $device;
}
function getHostOS($hostname, $community, $snmpver, $port) {
function getHostOS($device) {
global $config;
$sysDescr_cmd = $config['snmpget']." -m SNMPv2-MIB -O qv -" . $snmpver . " -c " . $community . " " . $hostname.":".$port . " sysDescr.0";
$sysDescr_cmd = $config['snmpget']." -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " sysDescr.0";
$sysDescr = str_replace("\"", "", trim(shell_exec($sysDescr_cmd)));
$dir_handle = @opendir($config['install_dir'] . "/includes/osdiscovery") or die("Unable to open $path");
while ($file = readdir($dir_handle)) {
@@ -628,7 +628,8 @@ function fixIOSHardware($hardware){
function createHost ($host, $community, $snmpver, $port = 161){
$host = trim(strtolower($host));
$host_os = getHostOS($host, $community, $snmpver, $port);
$device = array('hostname' => $host, 'community' => $community, 'snmpver' => $snmpver, 'port' => $port);
$host_os = getHostOS($device);
if($host_os) {
$sql = mysql_query("INSERT INTO `devices` (`hostname`, `sysName`, `community`, `port`, `os`, `status`) VALUES ('$host', '$host', '$community', '$port', '$host_os', '1')");
if(mysql_affected_rows()) {