From e9ef8db683c26978a6f3d84a9ff5cfe88d0cee6c Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Sat, 6 Feb 2010 23:36:33 +0000 Subject: [PATCH] small fixes. hrDevice collection fixed. git-svn-id: http://www.observium.org/svn/observer/trunk@777 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/discovery/hr-device.inc.php | 3 ++- includes/polling/bgpPeer.inc.php | 8 ++++---- includes/syslog.php | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/includes/discovery/hr-device.inc.php b/includes/discovery/hr-device.inc.php index 3dd9a4c3a1..10da9f2889 100755 --- a/includes/discovery/hr-device.inc.php +++ b/includes/discovery/hr-device.inc.php @@ -4,7 +4,8 @@ echo("hrDevice : "); $hrDevice_oids = array('hrDeviceIndex','hrDeviceType','hrDeviceDescr','hrDeviceStatus','hrDeviceErrors','hrProcessorLoad'); -foreach ($hrDevice_oids as $oid) { $hrDevice_array = snmp_cache_oid($oid, $device, array(), "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"); } foreach($hrDevice_array[$device['device_id']] as $hrDevice) { if(is_array($hrDevice)) { diff --git a/includes/polling/bgpPeer.inc.php b/includes/polling/bgpPeer.inc.php index c1d257181e..422ed8fb6c 100755 --- a/includes/polling/bgpPeer.inc.php +++ b/includes/polling/bgpPeer.inc.php @@ -124,7 +124,7 @@ if ($device['os'] == "junos") $afi = $peer_afi['afi']; $safi = $peer_afi['safi']; - #echo($config['afi'][$afi][$safi]. " "); + if($debug) { echo("$afi $safi". $config['afi'][$afi][$safi]. "\n"); } $cbgp_cmd = $config['snmpget'] . " -m CISCO-BGP4-MIB -Ovq -" . $device['snmpver'] . " -c" . $device['community'] . " " . $device['hostname'].":".$device['port']; $cbgp_cmd .= " cbgpPeerAcceptedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; @@ -135,9 +135,9 @@ if ($device['os'] == "junos") $cbgp_cmd .= " cbgpPeerAdvertisedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; $cbgp_cmd .= " cbgpPeerSuppressedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; $cbgp_cmd .= " cbgpPeerWithdrawnPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi"; - #echo("\n$cbgp_cmd\n"); + if($debug) { echo("$cbgp_cmd\n"); } $cbgp_data = preg_replace("/^OID.*$/", "", trim(`$cbgp_cmd`)); - + if($debug) { echo("$cbgp_data\n"); } list($cbgpPeerAcceptedPrefixes,$cbgpPeerDeniedPrefixes,$cbgpPeerPrefixAdminLimit,$cbgpPeerPrefixThreshold,$cbgpPeerPrefixClearThreshold,$cbgpPeerAdvertisedPrefixes,$cbgpPeerSuppressedPrefixes,$cbgpPeerWithdrawnPrefixes) = explode("\n", $cbgp_data); $update = "UPDATE bgpPeers_cbgp SET"; @@ -150,7 +150,7 @@ if ($device['os'] == "junos") $update .= ", `cbgpPeerSuppressedPrefixes` = '$cbgpPeerSuppressedPrefixes'"; $update .= ", `cbgpPeerWithdrawnPrefixes` = '$cbgpPeerWithdrawnPrefixes'"; $update .= " WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '" . $peer['bgpPeerIdentifier'] . "' AND afi = '$afi' AND safi = '$safi'"; - + if($debug) { echo("MYSQL: $update\n"); } mysql_query($update); $cbgp_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cbgp-" . $peer['bgpPeerIdentifier'] . ".$afi.$safi.rrd"); diff --git a/includes/syslog.php b/includes/syslog.php index 20a4ee2b8d..a2a31d47fa 100755 --- a/includes/syslog.php +++ b/includes/syslog.php @@ -18,8 +18,8 @@ function process_syslog ($entry, $update) { $device_id_ip = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, interfaces AS I WHERE A.ipv4_address = '" . $entry['host']."' AND I.interface_id = A.interface_id"),0); - echo("SELECT device_id FROM ipv4_addresses AS A, interfaces AS I WHERE - A.ipv4_address = '" . $entry['host']."' AND I.interface_id = A.interface_id"); + #echo("SELECT device_id FROM ipv4_addresses AS A, interfaces AS I WHERE + #A.ipv4_address = '" . $entry['host']."' AND I.interface_id = A.interface_id"); if($device_id_ip) { $entry['device_id'] = $device_id_ip; @@ -66,7 +66,7 @@ function process_syslog ($entry, $update) { } $x = "UPDATE `syslog` set `device_id` = '".$entry['device_id']."', `program` = '".$entry['program']."', `msg` = '" . mysql_real_escape_string($entry['msg']) . "', processed = '1' WHERE `seq` = '" . $entry['seq'] . "'"; $entry['processed'] = 1; - if($update) { mysql_query($x); echo($x); } + if($update) { mysql_query($x); } unset ($fix); } else { $x = "DELETE FROM `syslog` where `seq` = '" . $entry['seq'] . "'";