mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user