librenms/poll-os.php
Adam Amstrong a65f5d72ea Tidy the things...
git-svn-id: http://www.observium.org/svn/observer/trunk@169 61d68cd4-352d-0410-923a-c4978735b2b8
2008-03-18 13:35:17 +00:00

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");
}
}
?>