Prometheus exporter for FRR version 3.0+ that collects metrics by using vtysh
and exposes them via HTTP, ready for collecting by Prometheus.
To run frr_exporter:
./frr_exporter [flags]
To view metrics on the default port (9342) and path (/metrics):
http://device:9342/metrics
To view available flags:
usage: frr_exporter [<flags>]
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--collector.bgp.peer-types
Enable scraping of BGP peer types from peer descriptions (default: disabled).
--collector.bgp.peer-descriptions
Add the BGP peer description as a label to peer metrics. (default: disabled).
--collector.bgp.peer-descriptions.plain-text
Use the full text field of the BGP peer description, instead of a JSON formatted
description (default: disabled).
--web.listen-address=":9342"
Address on which to expose metrics and web interface.
--web.telemetry-path="/metrics"
Path under which to expose metrics.
--frr.vtysh.path="/usr/bin/vtysh"
Path of vtysh.
--collector.bgp Collect BGP Metrics (default: enabled).
--collector.ospf Collect OSPF Metrics (default: enabled).
--collector.bgp6 Collect BGP IPv6 Metrics (default: disabled).
--collector.bgpl2vpn Collect BGP L2VPN Metrics (default: disabled).
--log.level="info" Only log messages with the given severity or above. Valid levels: [debug, info, warn,
error, fatal]
--log.format="logger:stderr"
Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or
"logger:stdout?json=true"
--version Show application version.
Promethues configuraiton:
scrape_configs:
- job_name: frr
static_configs:
- targets:
- device1:9342
- device2:9342
relabel_configs:
- source_labels: [__address__]
regex: "(.*):\d+"
target: instance
To disable a default collector, use the --no-collector.$name
flag, or
--collector.$name
to enable it.
Name | Description |
---|---|
BGP | Per VRF and address family (currently support unicast only) BGP metrics: - RIB entries - RIB memory usage - Configured peer count - Peer memory usage - Configure peer group count - Peer group memory usage - Peer messages in - Peer messages out - Peer active prfixes - Peer state (established/down) - Peer uptime |
OSPFv4 | Per VRF OSPF metrics: - Neighbors - Neighbor adjacencies |
Name | Description |
---|---|
BGP IPv6 | Per VRF and address family (currently support unicast only) BGP IPv6 metrics: - RIB entries - RIB memory usage - Configured peer count - Peer memory usage - Configure peer group count - Peer group memory usage - Peer messages in - Peer messages out - Peer active prfixes - Peer state (established/down) - Peer uptime |
BGP L2VPN | Per VRF and address family (currently support EVPN only) BGP L2VPN EVPN metrics: - RIB entries - RIB memory usage - Configured peer count - Peer memory usage - Configure peer group count - Peer group memory usage - Peer messages in - Peer messages out - Peer active prfixes - Peer state (established/down) - Peer uptime |
The description of a BGP peer can be added as a label to all peer metrics by passing the --collector.bgp.peer-descriptions
flag. The peer description must be JSON formatted with a desc
field. Example configuration:
router bgp 64512
neighbor 192.168.0.1 remote-as 64513
neighbor 192.168.0.1 description {"desc":"important peer"}
If an unstructured description is preferred, pass the --collector.bgp.peer-descriptions.plain-text
flag. Example configuration:
router bgp 64512
neighbor 192.168.0.1 remote-as 64513
neighbor 192.168.0.1 description important peer
Note, it recommended to leave this feature disabled as peer descriptions can easily change, resulting in a new time series.
FRR Exporter exposes a special metric, frr_bgp_peer_types_up
, that can be used in scenarios where you want to create Prometheus queries that can report on the number of types of BGP peers that are currently established, such as for Alert Manager. To implement this metric, a JSON formatted description with a 'type' field must be configured on your BGP group. FRR Exporter will then aggregate all BGP peers that are currently established and configured with that type.
For example, if you want to know how many BGP peers are currently established that provide internet, you'd set the description of all BGP groups that provide internet to {"type":"internet"}
and query Prometheus with frr_bgp_peer_types_up{type="internet"})
. Going further, if you want to create an alert when the number of established BGP peers that provide internet is 1 or less, you'd use sum(frr_bgp_peer_types_up{type="internet"}) <= 1
.
To enable frr_bgp_peer_types_up
, use the --collector.bgp.peer-types
flag.
go get github.com/tynany/frr_exporter
cd ${GOPATH}/src/github.com/prometheus/frr_exporter
go build
- Collector and main tests
- OSPF6
- ISIS
- Additional BGP SAFI
- Feel free to submit a new feature request