From 75502568cbbcb9b44513f289e896f894e7a157fd Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Fri, 4 Mar 2011 17:48:25 +0000 Subject: [PATCH] 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 --- poll-reachability.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/poll-reachability.php b/poll-reachability.php index cc8e2998a..4e87dadcc 100755 --- a/poll-reachability.php +++ b/poll-reachability.php @@ -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 {