poll-reachability.php: switch to isPingable() and snmp_get(), patch by Corentin Chary

git-svn-id: http://www.observium.org/svn/observer/trunk@1790 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-03-04 17:48:25 +00:00
parent 37fda25ead
commit 75502568cb

View File

@@ -8,21 +8,13 @@ include("includes/functions.php");
$device_query = mysql_query("SELECT * FROM `devices` WHERE `device_id` LIKE '%" . $argv[1] . "' AND disabled = '0' ORDER BY `device_id` DESC");
while ($device = mysql_fetch_array($device_query)) {
$id = $device['device_id'];
$hostname = $device['hostname'];
$old_status = $device['status'];
$community = $device['community'];
$snmpver = $device['snmpver'];
$port = $device['port'];
echo("$hostname ");
echo($device['hostname']. " ");
$status = shell_exec($config['fping'] . " $hostname | cut -d ' ' -f 3");
$status = trim($status);
if(strstr($status, "alive")) {
$pos = shell_exec($config['snmpget'] . " -m SNMPv2-MIB -$snmpver -c $community -t 1 $hostname:$port sysDescr.0");
echo($config['snmpget'] . " -m SNMPv2-MIB -$snmpver -c $community -t 1 $hostname:$port sysDescr.0");
if( isPingable($device['hostname']) ) {
$pos = snmp_get($device, "sysDescr.0", "-Oqv", "SNMPv2-MIB");
echo($device['protocol'].":".$device['hostname'].":".$device['port']." - ".$device['community']." ".$device['snmpver'].": ");
if($pos == '') {
$status='0';
} else {