\JunBGP
This class is responsible for getting Juniper BGP peers stats using SNMP.
Synopsis
class JunBGP
{
- // constants
- const OID_PEER_TABLE = '.1.3.6.1.4.1.2636.5.1.1.2';
- const OID_INDEX = '.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.14';
- const OID_REMOTEIP = '.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.11';
- const OID_AS = '.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.13';
- const OID_STATE = '.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.2';
- const OID_STATUS = '.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.3';
- const OID_TIMERS = '.1.3.6.1.4.1.2636.5.1.1.2.4.1.1.1';
- const OID_PREF_IN = '.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.7';
- const OID_PREF_OUT = '.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.10';
- // members
- protected $snmp = '';
- protected bool $rawCache = false;
- protected array $statesNames = ;
- protected array $statusNames = ;
- protected string $ip = '';
- protected string $community = '';
- // methods
- public void __construct()
- protected void setIp()
- protected void setCommunity()
- protected void initSNMP()
- protected array pollFullTable()
- protected string decodeIp()
- protected array parseData()
- protected array parseRemoteIp()
- public array getPeersData()
Constants
| Name | Value |
|---|---|
| OID_PEER_TABLE | '.1.3.6.1.4.1.2636.5.1.1.2' |
| OID_INDEX | '.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.14' |
| OID_REMOTEIP | '.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.11' |
| OID_AS | '.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.13' |
| OID_STATE | '.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.2' |
| OID_STATUS | '.1.3.6.1.4.1.2636.5.1.1.2.1.1.1.3' |
| OID_TIMERS | '.1.3.6.1.4.1.2636.5.1.1.2.4.1.1.1' |
| OID_PREF_IN | '.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.7' |
| OID_PREF_OUT | '.1.3.6.1.4.1.2636.5.1.1.2.6.2.1.10' |
Members
protected
- $community
—
string
SNMP community string - $ip
—
string
IP address of the BGP peer - $rawCache
—
bool
Determines whether to use raw SNMP cache - $snmp
—
Contains system SNMP Helper instance - $statesNames
—
array
Mapping of BGP state codes to state names - $statusNames
—
array
Mapping of BGP status codes to status names
Methods
protected
- decodeIp() — Decodes a hexadecimal IP address to a human-readable format
- initSNMP() — Initializes the SNMP helper instance
- parseData() — Parses raw SNMP data
- parseRemoteIp() — Extracts remote IP addresses from raw SNMP data OID itself
- pollFullTable() — Polls the full BGP peer table using SNMP
- setCommunity() — Sets the SNMP community string
- setIp() — Sets the IP address of the BGP peer
public
- __construct() — Quidquid latine dictum sit, altum sonatur
- getPeersData() — Retrieves BGP peer data