Files
librenms-librenms/poll-os.php
T

18 lines
604 B
PHP
Raw Normal View History

2007-04-03 14:10:23 +00:00
#!/usr/bin/php
<?
include("config.php");
include("includes/functions.php");
2007-04-08 21:27:05 +00:00
$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");
2007-04-03 14:10:23 +00:00
while ($device = mysql_fetch_array($device_query)) {
2008-03-18 13:35:17 +00:00
$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");
}
2007-04-03 14:10:23 +00:00
}
?>