remove cr between cdp&lldp, fix arp table, fix hr-device to poll les data.

git-svn-id: http://www.observium.org/svn/observer/trunk@852 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-02-15 03:05:16 +00:00
parent 2440e1e284
commit 272b5a0a7e
5 changed files with 9 additions and 246 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
echo("ARP Table : ");
$ipNetToMedia_data = shell_exec(($device['snmpver'] == 'v1' ? $config['snmpwalk'] : $config['snmpbulkwalk']) . " -m IP-MIB -Oq -".$device['snmpver']." -c ".$device['community']." ".$device['hostname']." ipNetToMediaPhysAddress");
$ipNetToMedia_data = snmp_walk($device, 'ipNetToMediaPhysAddress', '-Oq', 'IP-MIB');
$ipNetToMedia_data = str_replace("ipNetToMediaPhysAddress.", "", trim($ipNetToMedia_data));
$ipNetToMedia_data = str_replace("IP-MIB::", "", trim($ipNetToMedia_data));
#echo("$ipNetToMedia_data\n");
-2
View File
@@ -55,8 +55,6 @@ if($debug) {echo("$lldp_links");}
$discovered_links = (isset($cdp_links) ? $cdp_links : '') . (isset($lldp_links) ? $lldp_links : '');
echo "\n";
if($discovered_links != "\n") {
foreach ( explode("\n" ,$discovered_links) as $link ) {
if ($link == "") { break; }
+8 -4
View File
@@ -2,13 +2,15 @@
echo("hrDevice : ");
$hrDevice_oids = array('hrDeviceIndex','hrDeviceType','hrDeviceDescr','hrDeviceStatus','hrDeviceErrors','hrProcessorLoad');
$hrDevice_oids = array('hrDeviceEntry','hrProcessorEntry');
if($debug) {print_r($hrDevices);}
foreach ($hrDevice_oids as $oid) { $hrDevices = snmp_cache_oid($oid, $device, $hrDevices, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); }
foreach ($hrDevice_oids as $oid) { $hrDevice_array = snmp_cache_oid($oid, $device, $hrDevice_array, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); }
if($debug) {print_r($hrDevices);}
foreach($hrDevice_array[$device['device_id']] as $hrDevice) {
if(is_array($hrDevice)) {
foreach($hrDevices[$device['device_id']] as $hrDevice) {
if(is_array($hrDevice) && is_numeric($hrDevice['hrDeviceIndex'])) {
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `hrDevice` WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrDevice['hrDeviceIndex']."'"),0)) {
$update_query = "UPDATE `hrDevice` SET";
$update_query .= " `hrDeviceType` = '".mres($hrDevice[hrDeviceType])."'";
@@ -24,6 +26,7 @@ foreach($hrDevice_array[$device['device_id']] as $hrDevice) {
$insert_query = "INSERT INTO `hrDevice` (`hrDeviceIndex`,`device_id`,`hrDeviceType`,`hrDeviceDescr`,`hrDeviceStatus`,`hrDeviceErrors`) ";
$insert_query .= " VALUES ('".mres($hrDevice[hrDeviceIndex])."','".mres($device[device_id])."','".mres($hrDevice[hrDeviceType])."','".mres($hrDevice[hrDeviceDescr])."','".mres($hrDevice[hrDeviceStatus])."','".mres($hrDevice[hrDeviceErrors])."')";
@mysql_query($insert_query); $mysql++; echo("+");
if($debug) { print_r($hrDevice); echo("$insert_query" . mysql_affected_rows() . " row inserted"); }
}
$valid_hrDevice[$hrDevice[hrDeviceIndex]] = 1;
}
@@ -36,6 +39,7 @@ while ($test_hrDevice = mysql_fetch_array($query)) {
if(!$valid_hrDevice[$test_hrDevice[hrDeviceIndex]]) {
echo("-");
mysql_query("DELETE FROM `hrDevice` WHERE hrDevice_id = '" . $test_hrDevice['hrDevice_id'] . "'");
if($debug) { print_r($test_hrDevice); echo(mysql_affected_rows() . " row deleted"); }
}
}