mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #1184 from laf/issue-936
Updated BGP polling for Cisco to support CISCO-BGP4-MIB better
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
<div style='padding: 10px; height: 20px; clear: both; display: block;'>
|
||||
<div style='float: left; font-size: 22px; font-weight: bold;'>Local AS : <?php echo($device['bgpLocalAs']); ?></div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
$link_array = array('page' => 'device',
|
||||
@@ -13,6 +9,8 @@ if(!isset($vars['view'])) { $vars['view'] = "basic"; }
|
||||
|
||||
print_optionbar_start();
|
||||
|
||||
echo "<strong>Local AS : " .$device['bgpLocalAs']."</strong> ";
|
||||
|
||||
echo("<span style='font-weight: bold;'>BGP</span> » ");
|
||||
|
||||
if ($vars['view'] == "basic") { echo("<span class='pagemenu-selected'>"); }
|
||||
@@ -126,6 +124,11 @@ foreach (dbFetchRows("SELECT * FROM `bgpPeers` WHERE `device_id` = ? ORDER BY `b
|
||||
|
||||
unset($sep);
|
||||
|
||||
if (filter_var($peer['bgpLocalAddr'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== FALSE) {
|
||||
$peer['bgpPeerIdentifier'] = Net_IPv6::compress($peer['bgpPeerIdentifier']);
|
||||
}
|
||||
|
||||
|
||||
$graph_type = "bgp_updates";
|
||||
$peer_daily_url = "graph.php?id=" . $peer['bgpPeer_id'] . "&type=" . $graph_type . "&from=".$config['time']['day']."&to=".$config['time']['now']."&width=500&height=150";
|
||||
$peeraddresslink = "<span class=list-large><a onmouseover=\"return overlib('<img src=\'$peer_daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">" . $peer['bgpPeerIdentifier'] . "</a></span>";
|
||||
|
@@ -168,11 +168,22 @@ else
|
||||
|
||||
$graph_type = "bgp_updates";
|
||||
$local_daily_url = "graph.php?id=" . $peer['bgpPeer_id'] . "&type=" . $graph_type . "&from=".$config['time']['day']."&to=".$config['time']['now']."&width=500&height=150&&afi=ipv4&safi=unicast";
|
||||
$localaddresslink = "<span class=list-large><a href='device/device=" . $peer['device_id'] . "/tab=routing/proto=bgp/' onmouseover=\"return overlib('<img src=\'$local_daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">" . $peer['bgpLocalAddr'] . "</a></span>";
|
||||
if (filter_var($peer['bgpLocalAddr'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== FALSE) {
|
||||
$peer_ip = Net_IPv6::compress($peer['bgpLocalAddr']);
|
||||
} else {
|
||||
$peer_ip = $peer['bgpLocalAddr'];
|
||||
}
|
||||
$localaddresslink = "<span class=list-large><a href='device/device=" . $peer['device_id'] . "/tab=routing/proto=bgp/' onmouseover=\"return overlib('<img src=\'$local_daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">" . $peer_ip . "</a></span>";
|
||||
|
||||
$graph_type = "bgp_updates";
|
||||
$peer_daily_url = "graph.php?id=" . $peer['bgpPeer_id'] . "&type=" . $graph_type . "&from=".$config['time']['day']."&to=".$config['time']['now']."&width=500&height=150";
|
||||
$peeraddresslink = "<span class=list-large><a href='device/device=" . $peer['device_id'] . "/tab=routing/proto=bgp/' onmouseover=\"return overlib('<img src=\'$peer_daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">" . $peer['bgpPeerIdentifier'] . "</a></span>";
|
||||
if (filter_var($peer['bgpPeerIdentifier'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== FALSE) {
|
||||
$peer_ident = Net_IPv6::compress($peer['bgpPeerIdentifier']);
|
||||
} else {
|
||||
$peer_ident = $peer['bgpPeerIdentifier'];
|
||||
}
|
||||
|
||||
$peeraddresslink = "<span class=list-large><a href='device/device=" . $peer['device_id'] . "/tab=routing/proto=bgp/' onmouseover=\"return overlib('<img src=\'$peer_daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">" . $peer_ident . "</a></span>";
|
||||
|
||||
echo('<tr class="bgp"' . ($peer['alert'] ? ' bordercolor="#cc0000"' : '') . ($peer['disabled'] ? ' bordercolor="#cccccc"' : '') . ">");
|
||||
|
||||
@@ -247,4 +258,3 @@ else
|
||||
echo("</table>");
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -20,18 +20,33 @@ if ($config['enable_bgp'])
|
||||
echo("Updated AS ");
|
||||
}
|
||||
|
||||
$peers_data = snmp_walk($device, "BGP4-MIB::bgpPeerRemoteAs", "-Oq", "BGP4-MIB", $config['mibdir']);
|
||||
$peer2 = FALSE;
|
||||
$peers_data = snmp_walk($device, "cbgpPeer2RemoteAs", "-Oq", "CISCO-BGP4-MIB", $config['mibdir']);
|
||||
if (empty($peers_data)) {
|
||||
$peers_data = snmp_walk($device, "BGP4-MIB::bgpPeerRemoteAs", "-Oq", "BGP4-MIB", $config['mibdir']);
|
||||
} else {
|
||||
$peer2 = TRUE;
|
||||
}
|
||||
if ($debug) { echo("Peers : $peers_data \n"); }
|
||||
$peers = trim(str_replace("BGP4-MIB::bgpPeerRemoteAs.", "", $peers_data));
|
||||
$peers = trim(str_replace("CISCO-BGP4-MIB::cbgpPeer2RemoteAs.", "", $peers_data));
|
||||
$peers = trim(str_replace("BGP4-MIB::bgpPeerRemoteAs.", "", $peers));
|
||||
|
||||
foreach (explode("\n", $peers) as $peer)
|
||||
{
|
||||
if ($peer2 === TRUE) {
|
||||
list($ver, $peer) = explode(".", $peer,2);
|
||||
}
|
||||
list($peer_ip, $peer_as) = explode(" ", $peer);
|
||||
if (strstr($peer_ip, ":")) {
|
||||
$peer_ip_snmp = preg_replace("/:/", ' ', $peer_ip);
|
||||
$peer_ip = preg_replace("/(\S+\s+\S+)\s/", '$1:', $peer_ip_snmp);
|
||||
$peer_ip = str_replace('"','',str_replace(' ','',$peer_ip));
|
||||
}
|
||||
|
||||
if ($peer && $peer_ip != "0.0.0.0")
|
||||
{
|
||||
if ($debug) { echo("Found peer $peer_ip (AS$peer_as)\n"); }
|
||||
$peerlist[] = array('ip' => $peer_ip, 'as' => $peer_as);
|
||||
$peerlist[] = array('ip' => $peer_ip, 'as' => $peer_as, 'ver' => $ver);
|
||||
}
|
||||
} # Foreach
|
||||
|
||||
@@ -92,18 +107,31 @@ if ($config['enable_bgp'])
|
||||
// Get afi/safi and populate cbgp on cisco ios (xe/xr)
|
||||
unset($af_list);
|
||||
|
||||
$af_data = snmp_walk($device, "cbgpPeerAddrFamilyName." . $peer['ip'], "-OsQ", "CISCO-BGP4-MIB", $config['mibdir']);
|
||||
if ($debug) { echo("afi data :: $af_data \n"); }
|
||||
|
||||
$afs = trim(str_replace("cbgpPeerAddrFamilyName.".$peer['ip'].".", "", $af_data));
|
||||
foreach (explode("\n", $afs) as $af)
|
||||
if ($peer2 === TRUE) {
|
||||
$af_data = snmpwalk_cache_oid($device, "cbgpPeer2AddrFamilyEntry", $cbgp, "CISCO-BGP4-MIB", $config['mibdir']);
|
||||
} else {
|
||||
$af_data = snmpwalk_cache_oid($device, "cbgpPeerAddrFamilyEntry", $cbgp, "CISCO-BGP4-MIB", $config['mibdir']);
|
||||
}
|
||||
if ($debug) {
|
||||
echo("afi data :: ");
|
||||
print_r($af_data);
|
||||
}
|
||||
foreach ($af_data as $k => $v)
|
||||
{
|
||||
if ($debug) { echo("AFISAFI = $af\n"); }
|
||||
list($afisafi, $text) = explode(" = ", $af);
|
||||
list($afi, $safi) = explode(".", $afisafi);
|
||||
if ($afi && $safi)
|
||||
if ($peer2 === TRUE) {
|
||||
list(,$k) = explode('.',$k,2);
|
||||
}
|
||||
if ($debug) { echo("AFISAFI = $k\n"); }
|
||||
$afisafi_tmp = explode('.', $k);
|
||||
$safi = array_pop($afisafi_tmp);
|
||||
$afi = array_pop($afisafi_tmp);
|
||||
$bgp_ip = str_replace(".$afi.$safi", "", $k);
|
||||
$bgp_ip = preg_replace("/:/"," ", $bgp_ip);
|
||||
$bgp_ip = preg_replace("/(\S+\s+\S+)\s/", '$1:', $bgp_ip);
|
||||
$bgp_ip = str_replace('"','',str_replace(' ','',$bgp_ip));
|
||||
if ($afi && $safi && $bgp_ip == $peer['ip'])
|
||||
{
|
||||
$af_list[$afi][$safi] = 1;
|
||||
$af_list[$bgp_ip][$afi][$safi] = 1;
|
||||
if (dbFetchCell("SELECT COUNT(*) from `bgpPeers_cbgp` WHERE device_id = ? AND bgpPeerIdentifier = ?, AND afi=? AND safi=?",array($device['device_id'], $peer['ip'],$afi,$safi)) == 0)
|
||||
{
|
||||
dbInsert(array('device_id' => $device['device_id'], 'bgpPeerIdentifier' => $peer['ip'], 'afi' => $afi, 'safi' => $safi), 'bgpPeers_cbgp');
|
||||
@@ -170,7 +198,7 @@ if ($config['enable_bgp'])
|
||||
{
|
||||
$afi = $entry['afi'];
|
||||
$safi = $entry['safi'];
|
||||
if (!$af_list[$afi][$safi])
|
||||
if (!$af_list[$afi][$safi] || !$af_list[$entry['bgpPeerIdentifier']][$afi][$safi])
|
||||
{
|
||||
dbDelete('bgpPeers_cbgp', '`device_id` = ? AND `bgpPeerIdentifier` = ?, afi=?, safi=?', array($device['device_id'],$peer['ip'],$afi,$safi));
|
||||
}
|
||||
@@ -212,4 +240,3 @@ if ($config['enable_bgp'])
|
||||
echo("\n");
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -1208,6 +1208,21 @@ function first_oid_match($device, $list) {
|
||||
}
|
||||
}
|
||||
|
||||
function hex_to_ip($hex) {
|
||||
$return = "";
|
||||
if (filter_var($hex, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === FALSE && filter_var($hex, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === FALSE) {
|
||||
$hex_exp = explode(' ', $hex);
|
||||
foreach ($hex_exp as $item) {
|
||||
if (!empty($item) && $item != "\"") {
|
||||
$return .= hexdec($item).'.';
|
||||
}
|
||||
}
|
||||
$return = substr($return, 0, -1);
|
||||
} else {
|
||||
$return = $hex;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
function fix_integer_value($value) {
|
||||
if ($value < 0) {
|
||||
$return = 4294967296+$value;
|
||||
|
@@ -10,18 +10,69 @@ if ($config['enable_bgp'])
|
||||
{
|
||||
// Poll BGP Peer
|
||||
|
||||
$peer2 = FALSE;
|
||||
echo("Checking BGP peer ".$peer['bgpPeerIdentifier']." ");
|
||||
|
||||
if (!strstr($peer['bgpPeerIdentifier'],':'))
|
||||
if (!empty($peer['bgpPeerIdentifier']) && $device['os'] != "junos")
|
||||
{
|
||||
# v4 BGP4 MIB
|
||||
// FIXME - needs moved to function
|
||||
$peer_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m BGP4-MIB -OUvq " . snmp_gen_auth($device) . " " . $device['hostname'].":".$device['port'] . " ";
|
||||
$peer_cmd .= "bgpPeerState." . $peer['bgpPeerIdentifier'] . " bgpPeerAdminStatus." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerOutUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerInTotalMessages." . $peer['bgpPeerIdentifier'] . " ";
|
||||
$peer_cmd .= "bgpPeerOutTotalMessages." . $peer['bgpPeerIdentifier'] . " bgpPeerFsmEstablishedTime." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdateElapsedTime." . $peer['bgpPeerIdentifier'] . " ";
|
||||
$peer_cmd .= "bgpPeerLocalAddr." . $peer['bgpPeerIdentifier'] . "";
|
||||
$peer_data = trim(`$peer_cmd`);
|
||||
$peer_data_check = snmpwalk_cache_oid($device, "cbgpPeer2RemoteAs", array(), "CISCO-BGP4-MIB", $config['mibdir']);
|
||||
if (count($peer_data_check) > 0) {
|
||||
$peer2 = TRUE;
|
||||
}
|
||||
|
||||
if ($peer2 === TRUE) {
|
||||
if (strstr($peer['bgpPeerIdentifier'], ":")) {
|
||||
$bgp_peer_ident = ipv62snmp($peer['bgpPeerIdentifier']);
|
||||
} else {
|
||||
$bgp_peer_ident = $peer['bgpPeerIdentifier'];
|
||||
}
|
||||
if (strstr($peer['bgpPeerIdentifier'],":")) {
|
||||
$ip_type = 2;
|
||||
$ip_len = 16;
|
||||
$ip_ver = 'ipv6';
|
||||
} else {
|
||||
$ip_type = 1;
|
||||
$ip_len = 4;
|
||||
$ip_ver = 'ipv4';
|
||||
}
|
||||
$peer_identifier = $ip_type . '.' . $ip_len . '.' . $bgp_peer_ident;
|
||||
$peer_data_tmp = snmp_get_multi($device,
|
||||
" cbgpPeer2State.". $peer_identifier .
|
||||
" cbgpPeer2AdminStatus.". $peer_identifier .
|
||||
" cbgpPeer2InUpdates." . $peer_identifier .
|
||||
" cbgpPeer2OutUpdates." . $peer_identifier .
|
||||
" cbgpPeer2InTotalMessages." . $peer_identifier .
|
||||
" cbgpPeer2OutTotalMessages." . $peer_identifier .
|
||||
" cbgpPeer2FsmEstablishedTime." . $peer_identifier .
|
||||
" cbgpPeer2InUpdateElapsedTime." . $peer_identifier .
|
||||
" cbgpPeer2LocalAddr." . $peer_identifier, "-OQUs", "CISCO-BGP4-MIB",$config['mibdir']);
|
||||
$ident = "$ip_ver.\"".$bgp_peer_ident.'"';
|
||||
unset($peer_data);
|
||||
$ident_key = array_keys($peer_data_tmp);
|
||||
foreach ($peer_data_tmp[$ident_key[0]] as $k => $v) {
|
||||
if (strstr($k, "cbgpPeer2LocalAddr")) {
|
||||
if ($ip_ver == 'ipv6') {
|
||||
$v = str_replace('"','',$v);
|
||||
$v = rtrim($v);
|
||||
$v = preg_replace("/(\S+\s+\S+)\s/", '$1:', $v);
|
||||
$v = strtolower($v);
|
||||
} else {
|
||||
$v = hex_to_ip($v);
|
||||
}
|
||||
}
|
||||
$peer_data .= "$v\n";
|
||||
}
|
||||
} else {
|
||||
$peer_cmd = $config['snmpget'] . " -M " . $config['mibdir'] . " -m BGP4-MIB -OUvq " . snmp_gen_auth($device) . " " . $device['hostname'] . ":" . $device['port'] . " ";
|
||||
$peer_cmd .= "bgpPeerState." . $peer['bgpPeerIdentifier'] . " bgpPeerAdminStatus." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerOutUpdates." . $peer['bgpPeerIdentifier'] . " bgpPeerInTotalMessages." . $peer['bgpPeerIdentifier'] . " ";
|
||||
$peer_cmd .= "bgpPeerOutTotalMessages." . $peer['bgpPeerIdentifier'] . " bgpPeerFsmEstablishedTime." . $peer['bgpPeerIdentifier'] . " bgpPeerInUpdateElapsedTime." . $peer['bgpPeerIdentifier'] . " ";
|
||||
$peer_cmd .= "bgpPeerLocalAddr." . $peer['bgpPeerIdentifier'] . "";
|
||||
$peer_data = trim(`$peer_cmd`);
|
||||
}
|
||||
list($bgpPeerState, $bgpPeerAdminStatus, $bgpPeerInUpdates, $bgpPeerOutUpdates, $bgpPeerInTotalMessages, $bgpPeerOutTotalMessages, $bgpPeerFsmEstablishedTime, $bgpPeerInUpdateElapsedTime, $bgpLocalAddr) = explode("\n", $peer_data);
|
||||
$bgpLocalAddr = str_replace('"','',str_replace(' ','',$bgpLocalAddr));
|
||||
}
|
||||
else
|
||||
if ($device['os'] == "junos")
|
||||
@@ -134,23 +185,79 @@ if ($config['enable_bgp'])
|
||||
$safi = $peer_afi['safi'];
|
||||
if ($debug) { echo("$afi $safi\n"); }
|
||||
|
||||
if ($device['os_group'] == "cisco")
|
||||
{
|
||||
// FIXME - move to function
|
||||
$cbgp_cmd = $config['snmpget'] . " -M ".$config['mibdir'] . " -m CISCO-BGP4-MIB -Ovq " . snmp_gen_auth($device) . " " . $device['hostname'].":".$device['port'];
|
||||
$cbgp_cmd .= " cbgpPeerAcceptedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerDeniedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixAdminLimit." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixThreshold." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixClearThreshold." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerAdvertisedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerSuppressedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerWithdrawnPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
if ($device['os_group'] == "cisco") {
|
||||
$bgp_peer_ident = ipv62snmp($peer['bgpPeerIdentifier']);
|
||||
if (strstr($peer['bgpPeerIdentifier'], ":")) {
|
||||
$ip_type = 2;
|
||||
$ip_len = 16;
|
||||
$ip_ver = 'ipv6';
|
||||
} else {
|
||||
$ip_type = 1;
|
||||
$ip_len = 4;
|
||||
$ip_ver = 'ipv4';
|
||||
}
|
||||
$ip_cast = 1;
|
||||
if ($peer_afi['safi'] == "multicast") {
|
||||
$ip_cast = 2;
|
||||
} elseif ($peer_afi['safi'] == "unicastAndMulticast") {
|
||||
$ip_cast = 3;
|
||||
} elseif ($peer_afi['safi'] == "vpn") {
|
||||
$ip_cast = 128;
|
||||
}
|
||||
$check = snmp_get($device,"cbgpPeer2AcceptedPrefixes.".$ip_type.'.'.$ip_len.'.'.$bgp_peer_ident.'.'.$ip_type.'.'.$ip_cast,"","CISCO-BGP4-MIB", $config['mibdir']);
|
||||
|
||||
if ($debug) { echo("$cbgp_cmd\n"); }
|
||||
$cbgp_data = preg_replace("/^OID.*$/", "", trim(`$cbgp_cmd`));
|
||||
$cbgp_data = preg_replace("/No Such Instance currently exists at this OID/", "0", $cbgp_data);
|
||||
if ($debug) { echo("$cbgp_data\n"); }
|
||||
if(!empty($check)) {
|
||||
$cgp_peer_identifier = $ip_type . '.' . $ip_len . '.' . $bgp_peer_ident . '.' . $ip_type . '.' . $ip_cast;
|
||||
$cbgp_data_tmp = snmp_get_multi($device,
|
||||
" cbgpPeer2AcceptedPrefixes.". $cgp_peer_identifier .
|
||||
" cbgpPeer2DeniedPrefixes.". $cgp_peer_identifier .
|
||||
" cbgpPeer2PrefixAdminLimit." . $cgp_peer_identifier .
|
||||
" cbgpPeer2PrefixThreshold." . $cgp_peer_identifier .
|
||||
" cbgpPeer2PrefixClearThreshold." . $cgp_peer_identifier .
|
||||
" cbgpPeer2AdvertisedPrefixes." . $cgp_peer_identifier .
|
||||
" cbgpPeer2SuppressedPrefixes." . $cgp_peer_identifier .
|
||||
" cbgpPeer2WithdrawnPrefixes." . $cgp_peer_identifier, "-OQUs", "CISCO-BGP4-MIB",$config['mibdir']);
|
||||
$ident = "$ip_ver.\"".$peer['bgpPeerIdentifier'].'"'. '.' . $ip_type . '.' . $ip_cast;
|
||||
unset($cbgp_data);
|
||||
$temp_keys = array_keys($cbgp_data_tmp);
|
||||
unset($temp_data);
|
||||
$temp_data['cbgpPeer2AcceptedPrefixes'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2AcceptedPrefixes'];
|
||||
$temp_data['cbgpPeer2DeniedPrefixes'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2DeniedPrefixes'];
|
||||
$temp_data['cbgpPeer2PrefixAdminLimit'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2PrefixAdminLimit'];
|
||||
$temp_data['cbgpPeer2PrefixThreshold'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2PrefixThreshold'];
|
||||
$temp_data['cbgpPeer2PrefixClearThreshold'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2PrefixClearThreshold'];
|
||||
$temp_data['cbgpPeer2AdvertisedPrefixes'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2AdvertisedPrefixes'];
|
||||
$temp_data['cbgpPeer2SuppressedPrefixes'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2SuppressedPrefixes'];
|
||||
$temp_data['cbgpPeer2WithdrawnPrefixes'] = $cbgp_data_tmp[$temp_keys[0]]['cbgpPeer2WithdrawnPrefixes'];
|
||||
foreach ($temp_data as $k => $v) {
|
||||
$cbgp_data .= "$v\n";
|
||||
}
|
||||
if ($debug) {
|
||||
echo("$cbgp_data\n");
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// FIXME - move to function
|
||||
$cbgp_cmd = $config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-BGP4-MIB -Ovq " . snmp_gen_auth($device) . " " . $device['hostname'] . ":" . $device['port'];
|
||||
$cbgp_cmd .= " cbgpPeerAcceptedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerDeniedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixAdminLimit." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixThreshold." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerPrefixClearThreshold." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerAdvertisedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerSuppressedPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
$cbgp_cmd .= " cbgpPeerWithdrawnPrefixes." . $peer['bgpPeerIdentifier'] . ".$afi.$safi";
|
||||
|
||||
if ($debug) {
|
||||
echo("$cbgp_cmd\n");
|
||||
}
|
||||
$cbgp_data = preg_replace("/^OID.*$/", "", trim(`$cbgp_cmd`));
|
||||
$cbgp_data = preg_replace("/No Such Instance currently exists at this OID/", "0", $cbgp_data);
|
||||
if ($debug) {
|
||||
echo("$cbgp_data\n");
|
||||
}
|
||||
}
|
||||
list($cbgpPeerAcceptedPrefixes,$cbgpPeerDeniedPrefixes,$cbgpPeerPrefixAdminLimit,$cbgpPeerPrefixThreshold,$cbgpPeerPrefixClearThreshold,$cbgpPeerAdvertisedPrefixes,$cbgpPeerSuppressedPrefixes,$cbgpPeerWithdrawnPrefixes) = explode("\n", $cbgp_data);
|
||||
}
|
||||
|
||||
@@ -227,4 +334,3 @@ if ($config['enable_bgp'])
|
||||
} // End While loop on peers
|
||||
} // End check for BGP support
|
||||
|
||||
?>
|
||||
|
3353
mibs/CISCO-BGP4-MIB
3353
mibs/CISCO-BGP4-MIB
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user