Skip to content

BGP monitoring plugin

Article last updated: 2026-12-02.

What it does

The BGP monitoring plugin checks the BGP neighbours of a router over SNMP and returns a single value: 1 when every neighbour is established and sending prefixes, 0 when any neighbour is down, administratively down, sending no prefixes, or when the router cannot be queried.

The plugin is a Pandora FMS server plugin. It runs on the Pandora FMS server, connects to the router with an SNMP community, reads the BGP4-MIB and prints the result on standard output. It does not create an agent or a module by itself: the module is created in Pandora FMS with the plugin and receives the 1 or 0 value on each execution.

Prepare

Compatibility

Scope State Evidence
Routers that expose the BGP4-MIB (1.3.6.1.2.1.15) Required The plugin reads bgpPeerState, bgpPeerAdminStatus and bgpPeerInUpdates
SNMP v1 or v2c Required The plugin opens the session with -version => 2 and a community
SNMP v3 Not supported The plugin has no SNMPv3 options
Perl Net::SNMP module Required The script imports Net::SNMP
Pandora FMS NG 784 and later Not validated No release-specific validation record exists

Requirements

  1. A router with BGP configured and the BGP4-MIB enabled in its SNMP agent.
  2. The SNMP community that allows read access to the BGP4-MIB.
  3. Network access from the Pandora FMS server to the router on UDP port 161.
  4. The Perl module Net::SNMP installed on the Pandora FMS server. On Debian and Ubuntu it is available as libnet-snmp-perl; on Rocky Linux and RHEL, as perl-Net-SNMP.

Install the plugin

Copy bgp_plugin.pl to the Pandora FMS server plugin directory and give it execute permission:

cp bgp_plugin.pl /usr/share/pandora_server/util/plugin/
chmod +x /usr/share/pandora_server/util/plugin/bgp_plugin.pl

Register it in the console from Plugins → Management → Create:

Field Value
Name BGP Plugin
Filename bgp_plugin.pl
Timeout 20
Parameters -r _field1_ -c _field2_
Macros router, community

The plugin definition provided with the package already contains these values. Install the package from the console if you prefer not to create the definition by hand.

Configure

The plugin takes two parameters:

bgp_plugin.pl -r <ROUTER> -c <COMMUNITY>
Option Required Description
-r, --router Yes Router address or host name.
-c, --community Yes SNMP read community.
-v No Prints the version and the usage text.
-h, --help No Prints the usage text.

Create a module in Pandora FMS that uses the plugin:

Module field Value
Module type generic_proc
Plugin BGP Plugin
Router Router address
Community SNMP community
Module interval The desired polling interval

generic_proc treats 1 as normal and 0 as critical, which matches the plugin output. If you prefer a generic data module, create a generic_data module and set min_critical to 1 so that a value of 0 raises a critical alert.

Verify

Run the plugin manually from the Pandora FMS server:

/usr/share/pandora_server/util/plugin/bgp_plugin.pl -r <ROUTER> -c <COMMUNITY>

The output is one line:

1

or

0

1 means that every BGP neighbour is established and sends at least one prefix. 0 means that at least one neighbour is not established, a neighbour is administratively down, a neighbour sends no prefixes, the router exposes no BGP information, or the SNMP query failed.

Understand the results

The plugin evaluates every row of the bgpPeerTable:

  • Peer state: the peer must be established (state 6). A peer in any other state produces 0.
  • Administrative state: when a peer is not established and its administrative status is 2 (down), the plugin ignores it and does not fail the check. This avoids alerting on peers that were intentionally disabled.
  • Received prefixes: an established peer that reports zero prefixes in bgpPeerInUpdates produces 0.
  • No BGP data: if the SNMP walk returns no peer rows, the plugin produces 0.
  • SNMP failure: if the session cannot be opened or a required OID cannot be read, the plugin produces 0.

The plugin does not report which peer caused the failure. Use snmpwalk against the router to identify the neighbour when the module is critical.

Operate and troubleshoot

  • Can't locate Net/SNMP.pm — install the Perl Net::SNMP module on the Pandora FMS server.
  • Always 0 and the router is healthy — check the community, the SNMP ACL, UDP 161 and that the router exposes the BGP4-MIB. Run snmpwalk -v2c -c <COMMUNITY> <ROUTER> 1.3.6.1.2.1.15 to confirm.
  • Message size exceeded buffer maxMsgSize — the SNMP response is larger than the session buffer. The plugin uses get_bulk_request with 20 repetitions; reduce the number of BGP peers or query the router from a host with a larger SNMP buffer.
  • A peer that is intentionally disabled makes the module critical — the plugin ignores administratively down peers, but a peer that is enabled and not established still produces 0. Disable the peer in the router or adjust the check.
  • The module does not update — confirm that the plugin is registered with the -r _field1_ -c _field2_ parameters and that the module has a router and a community.

Reference

Command-line options

Option Description
-r <router> Router address or host name.
-c <community> SNMP read community.
-v Prints the version and usage.
-h Prints usage.

SNMP objects read

Object OID
bgpPeerRemoteAddr 1.3.6.1.2.1.15.3.1.7
bgpPeerState 1.3.6.1.2.1.15.3.1.2
bgpPeerAdminStatus 1.3.6.1.2.1.15.3.1.3
bgpPeerInUpdates 1.3.6.1.2.1.15.3.1.10

Addon identity

Field Value
Marketplace identifier pandorafms.bgp
Marketplace name BGP monitoring
Package bgp_plugin.pspz2
Type Server plugin, SNMP
Executable bgp_plugin.pl
License Free download