mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
small fixes. hrDevice collection fixed.
git-svn-id: http://www.observium.org/svn/observer/trunk@777 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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'] . "'";
|
||||
|
||||
Reference in New Issue
Block a user