BGP (Border Gateway Protocol) peer sessions are the backbone of Internet routing. Monitoring BGP peer sessions — tracking adjacency state, route exchange health, prefix counts, and session stability — is critical for network reliability. A dropped BGP session can cause traffic blackholing, route flapping, or prefix withdrawal affecting thousands of downstream networks.
In this guide, we compare three open-source routing daemons for their BGP peer session monitoring capabilities: GoBGP, FRRouting, and BIRD. We examine how each tool exposes session state, supports programmatic monitoring, and integrates with observability stacks.
Why BGP Peer Session Monitoring Matters
BGP operates as a long-lived TCP session (port 179) between peers. Each session goes through several states: Idle, Connect, Active, OpenSent, OpenConfirm, and Established. Monitoring these states is essential for:
- Session health: Detecting dropped or stuck BGP sessions before they impact routing
- Prefix count validation: Ensuring the expected number of routes are received from each peer
- Route flapping detection: Identifying unstable peers that frequently reset sessions
- Convergence tracking: Measuring how quickly sessions re-establish after a failure
- Policy verification: Confirming that route filters, community assignments, and path attributes are applied correctly
Tool Comparison
| Feature | GoBGP | FRRouting | BIRD |
|---|---|---|---|
| Monitoring API | gRPC (native) | REST API + VTYSH | CLI + UNIX socket |
| Session State Export | Real-time gRPC streams | VTYSH show bgp summary | birdc show protocols |
| Programmatic Access | Full gRPC API (Go, Python, etc.) | REST API (FRR 9+) | Limited (parser-based) |
| Prometheus Exporter | Community gobgp_exporter | Official frr_exporter | Community bird_exporter |
| BGP Session Events | Event-driven (gRPC subscribe) | Syslog + VTYSH polling | Syslog + CLI polling |
| Graceful Restart | Yes | Yes | Yes |
| BFD Integration | Yes | Yes | Yes |
| Docker Image | osrg/gobgp | frrouting/frr | Community images |
| GitHub Stars | 4,055+ | 4,132+ | 188+ |
| Last Updated | May 2026 | May 2026 | May 2026 |
GoBGP BGP Peer Monitoring
GoBGP provides the most developer-friendly monitoring interface among the three, with a native gRPC API that streams real-time BGP session events.
Docker Compose Deployment
| |
GoBGP Configuration with Monitoring
| |
Monitoring BGP Peers via gRPC
GoBGP’s gRPC API allows real-time monitoring of all peer sessions:
| |
GoBGP monitoring strengths:
- Real-time event streaming: Subscribe to
WatchEventfor instant session state change notifications - JSON output: All CLI commands support
-jfor JSON-formatted output - gRPC service definitions: Protobuf definitions available for building custom monitoring tools
- BMP support: BGP Monitoring Protocol (RFC 7854) for centralized monitoring
- Python client: Official
pygobgplibrary for programmatic access
FRRouting BGP Peer Monitoring
FRRouting provides multiple monitoring interfaces: the traditional VTYSH CLI, a modern REST API, and Prometheus metrics export.
Docker Compose Deployment
| |
FRRouting BGP Configuration with Monitoring
| |
Monitoring BGP Peers via VTYSH and REST API
| |
FRRouting monitoring strengths:
- Multiple interfaces: VTYSH (CLI), REST API, SNMP, and Prometheus exporter
- BFD integration: Fast failure detection for BGP sessions
- Graceful Restart: Session recovery without route withdrawal
- Comprehensive logging: Session state changes logged with timestamps
- frr_exporter: Official Prometheus exporter with BGP peer metrics
BIRD BGP Peer Monitoring
BIRD takes a minimalist approach to BGP peer monitoring, relying on its CLI interface and syslog output for session state information.
Docker Compose Deployment
| |
BIRD BGP Configuration with Monitoring
| |
Monitoring BGP Peers via BIRD CLI
| |
BIRD monitoring strengths:
- Lightweight: Minimal resource usage (~5 MB per daemon)
- Clean output: Structured, parseable CLI output
- bird_exporter: Community Prometheus exporter for BGP metrics
- Syslog integration: Session state changes logged to syslog
- Powerful filtering: BIRD’s expression language for route policy verification
Building a BGP Monitoring Dashboard
For comprehensive BGP peer session monitoring, combine the routing daemon’s native monitoring with an observability stack:
Prometheus + Grafana Setup
| |
Key Prometheus metrics for BGP monitoring:
frr_bgp_peer_state— BGP session state (1=Established, 2=Idle, etc.)frr_bgp_prefixes_accepted— Number of prefixes received from each peerfrr_bgp_peer_uptime_seconds— Session uptime for stability trackingbird_protocol_state— BIRD protocol state per peerbird_bgp_routes_received— Route count per BGP peer
Why Self-Host Your BGP Monitoring?
Complete Visibility
Self-hosted BGP monitoring gives you direct access to peer session state, route exchange statistics, and protocol-level diagnostics. You are not dependent on third-party looking glass services or external monitoring platforms that may have limited visibility into your specific peer sessions.
For BGP route alerting, see our BGP monitoring and route alerting guide. For OSPF adjacency monitoring (the IGP counterpart), our OSPF monitoring guide covers the link-state monitoring landscape. For BGP communities management, our communities management article covers route tagging strategies.
Faster Incident Response
When a BGP session drops, every second counts. Self-hosted monitoring with real-time alerts (via Prometheus Alertmanager or custom gRPC event handlers) means you detect session failures in seconds rather than waiting for external monitoring checks that poll every 5-15 minutes.
Cost and Compliance
Enterprise BGP monitoring platforms can cost thousands per month. Open-source alternatives provide the same visibility at zero licensing cost. Additionally, keeping BGP monitoring data on your own infrastructure ensures compliance with data sovereignty requirements.
FAQ
What is the most important BGP peer session metric to monitor?
Session state is the primary metric — you need to know immediately when a BGP session transitions from Established to any other state. Secondary metrics include prefix counts (sudden drops indicate route withdrawal or filtering issues), session uptime (for stability trending), and BFD state (for fast failure detection).
How do I detect BGP route flapping?
Route flapping is detected by monitoring rapid session state changes. Configure BGP route dampening to automatically suppress flapping routes. In FRRouting: bgp dampening 30 750 2000 300. In BIRD: use graceful restart with appropriate timers. Monitor session reset frequency with show bgp neighbors <ip> | grep "Connection resets".
Can I monitor BGP sessions with Prometheus?
Yes. Use frr_exporter for FRRouting (official), bird_exporter for BIRD (community), or build a custom exporter for GoBGP using its gRPC API. Key metrics include peer state, prefix counts, session uptime, and BFD state changes.
What is BGP Graceful Restart and why does it matter for monitoring?
Graceful Restart (GR, RFC 4724) allows a BGP speaker to restart its control plane while preserving forwarding state. During GR, the peer continues to forward traffic using the last-known routes. Monitoring GR state is important — a peer stuck in GR for too long indicates a problem. All three implementations support GR.
How do I set up BGP session alerts?
Configure alerts on:
- Session state != Established for > 60 seconds
- Prefix count deviation > 10% from baseline
- Session uptime reset (indicates flapping)
- BFD state down Use Prometheus Alertmanager with FRRouting/BIRD exporters, or GoBGP’s gRPC event stream with a custom alerting service.
Should I use BFD with BGP?
Yes, absolutely. BFD (Bidirectional Forwarding Detection) provides sub-second failure detection for BGP sessions. Without BFD, BGP relies on the hold timer (typically 90-180 seconds) to detect peer failures. With BFD, failures are detected in milliseconds. All three implementations support BFD integration with BGP.
How do I troubleshoot a BGP session stuck in Active state?
A BGP session stuck in Active typically indicates:
- TCP connectivity issues: Check
tcpdump port 179for SYN packets - AS number mismatch: Verify
remote-asconfiguration on both sides - Router ID conflict: Ensure unique router IDs
- Firewall blocking: Verify port 179 is open in both directions
- Maximum prefix limit: Check if the peer has exceeded prefix limits
Use
show bgp neighbors <ip>(FRR) orshow protocols <name> all(BIRD) for detailed diagnostics.