mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	git-svn-id: http://www.observium.org/svn/observer/trunk@169 61d68cd4-352d-0410-923a-c4978735b2b8
		
			
				
	
	
		
			18 lines
		
	
	
		
			604 B
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			604 B
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/php
 | 
						|
<?
 | 
						|
 | 
						|
include("config.php");
 | 
						|
include("includes/functions.php");
 | 
						|
 | 
						|
$device_query = mysql_query("SELECT device_id,hostname,os,community,snmpver FROM `devices` WHERE `device_id` LIKE '%" . $argv[1] . "' AND status = '1' ORDER BY device_id DESC");
 | 
						|
while ($device = mysql_fetch_array($device_query)) {
 | 
						|
 | 
						|
   $os = getHostOS($device['hostname'], $device['community'], $device[snmpver]);
 | 
						|
 | 
						|
   if($os != $device['os']) {
 | 
						|
      $sql = mysql_query("UPDATE `devices` SET `os` = '$os' WHERE `device_id` = '".$device['device_id']."'");
 | 
						|
      echo("Updated host : ".$device['hostname']." ($os)\n");
 | 
						|
   }
 | 
						|
}
 | 
						|
?>
 |