The kernel's view of a session's TCP connection, which the status page shows on request since the last change, could not be looked at after the fact: a feed that crawled overnight left no record of whether the peer's window or our own side held it up. This change samples it at every scrape of `/metricz`: for each established session, one `NETLINK_SOCK_DIAG` round trip, and twenty gauges labelled by peer, `bgp_peer_tcp_*`: smoothed, least and variance of the round-trip time; the congestion window and segment size; the peer's receive window and ours; the send queue, the part of it not yet sent, the receive queue and the segments in flight; retransmitted and lost segments; the busy time and the time held up by the peer's window and by our send buffer, cumulative, so that their rates give the share of time a session is held up; octets sent and received; and the delivery and pacing rates. A session the kernel has no connection for loses its series, as does one that ends. `SessionHandle::metric_label` is the one place a peer's metric label is made (its name, or its address), used by the advertiser's gauge and here. Documentation: the metrics reference lists them; the monitoring guide gives the query for the share of time a session is held up by the neighbor's receive window, which is the question the overnight feed raised. Testing: a daemon in the Linux VM with one session shows the series and drops them when the session ends; the lab's basics phase checks the scrape for the FRR session's round-trip time; the workspace tests pass. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
6.0 KiB
6.0 KiB
+++ title = "Metrics Reference" description = "Describes the Prometheus metrics that Ferrix exports at /metricz, with their types and labels." weight = 4
[extra] nav = "Metrics" +++
Ferrix exports Prometheus metrics at /metricz on the HTTP interface. For
alerting rules based on these metrics, see
Alerting Rules.
Session Metrics
| Metric | Type | Description |
|---|---|---|
bgp_peer_up{peer} |
Gauge | 1 if the session with the configured neighbor is established; 0 otherwise. |
bgp_sessions_established |
Gauge | Number of sessions in the Established state. |
bgp_sessions_established_total |
Counter | Number of sessions that reached the Established state. |
bgp_messages_sent_total{type} |
Counter | Number of BGP messages sent, by type: open, update, notification, keepalive, route_refresh. |
bgp_messages_received_total{type} |
Counter | Number of BGP messages received, by type. |
bgp_update_errors_total{handling} |
Counter | Number of errors in received UPDATE messages that did not reset the session (RFC 7606), by handling: treat-as-withdraw, attribute-discard. |
bgp_connections_refused_total{reason} |
Counter | Number of inbound connections closed without a session, by reason: not a configured peer, too many connections from the address, peer is held down. |
bgp_connection_collisions_total{closed} |
Counter | Number of connection collisions resolved, by the connection that was closed: new, existing. |
Route Metrics
| Metric | Type | Description |
|---|---|---|
bgp_peer_routes{peer} |
Gauge | Number of the neighbor's routes in the routing table. |
bgp_peer_advertised_routes{peer} |
Gauge | Number of routes advertised to the neighbor and not withdrawn since. |
bgp_peer_tcp_rtt_seconds{peer} |
Gauge | Smoothed round-trip time of the session's TCP connection. Also bgp_peer_tcp_min_rtt_seconds and bgp_peer_tcp_rtt_variance_seconds. Linux only; sampled from the kernel at each scrape, as are all bgp_peer_tcp_* metrics. |
bgp_peer_tcp_cwnd_segments{peer} |
Gauge | Congestion window, in segments. bgp_peer_tcp_mss_bytes is the segment size. |
bgp_peer_tcp_send_window_bytes{peer} |
Gauge | The neighbor's receive window: what it lets Ferrix send. Zero while the neighbor is not reading. |
bgp_peer_tcp_receive_window_bytes{peer} |
Gauge | Ferrix's receive window: what it lets the neighbor send. |
bgp_peer_tcp_send_queue_bytes{peer} |
Gauge | Octets written and not yet acknowledged by the neighbor; bgp_peer_tcp_not_sent_bytes is the part not yet sent. |
bgp_peer_tcp_receive_queue_bytes{peer} |
Gauge | Octets received and not yet read. |
bgp_peer_tcp_unacked_segments{peer} |
Gauge | Segments in flight. |
bgp_peer_tcp_retransmitted_segments{peer} |
Gauge | Segments retransmitted over the connection's life. bgp_peer_tcp_lost_segments are those thought lost now. |
bgp_peer_tcp_busy_seconds{peer} |
Gauge | Time the connection had data to send, over its life. |
bgp_peer_tcp_receive_window_limited_seconds{peer} |
Gauge | Of the busy time, time the connection was held up by the neighbor's receive window. |
bgp_peer_tcp_send_buffer_limited_seconds{peer} |
Gauge | Of the busy time, time the connection was held up by the local send buffer being full. |
bgp_peer_tcp_sent_bytes{peer} |
Gauge | Octets sent over the connection's life. bgp_peer_tcp_received_bytes likewise. |
bgp_peer_tcp_delivery_rate_bytes_per_second{peer} |
Gauge | Delivery rate the kernel measured most recently; bgp_peer_tcp_pacing_rate_bytes_per_second is the rate it paces the connection at. |
bgp_peer_max_prefixes{peer} |
Gauge | Prefix limit of the neighbor (import.max_prefixes), if configured. |
bgp_prefix_limit_exceeded_total{peer} |
Counter | Number of sessions torn down because the neighbor exceeded its prefix limit. |
bgp_export_limit_exceeded_total{peer} |
Counter | Number of sessions torn down because the routes to be advertised to the neighbor exceeded its export limit (export_limits.max_prefixes). |
bgp_routes_rejected_total{peer,reason} |
Counter | Number of routes rejected by the import policy, by neighbor and reason. For the reasons, see Import Policy. |
bgp_routes_exported_total{change} |
Counter | Number of learned routes advertised (announced) to or withdrawn (withdrawn) from neighbors. |
bgp_local_routes |
Gauge | Number of originated routes. |
Routing Table Metrics
| Metric | Type | Description |
|---|---|---|
bgp_rib_routes |
Gauge | Number of received routes, counted separately for each neighbor. |
bgp_rib_prefixes |
Gauge | Number of prefixes with at least one route. |
bgp_rib_attribute_sets |
Gauge | Number of distinct sets of path attributes stored. |
bgp_rib_journal_entries |
Gauge | Number of best path changes not yet processed by all consumers. |
RPKI Metrics
| Metric | Type | Description |
|---|---|---|
bgp_rpki_vrps{family} |
Gauge | Number of Validated ROA Payloads in use, by address family: ipv4, ipv6. |
bgp_rpki_aspas |
Gauge | Number of customer ASs with an ASPA in use. |
bgp_rpki_updates_total |
Counter | Number of times the VRPs or ASPAs changed. |
Kernel Metrics
These metrics are exported if the kernel statement is configured.
| Metric | Type | Description |
|---|---|---|
bgp_kernel_routes |
Gauge | Number of routes installed by Ferrix in the kernel. |
bgp_kernel_routes_unresolved |
Gauge | Number of prefixes whose active route is not installed because its next hop is unresolvable. |
bgp_kernel_routes_refused |
Gauge | Number of prefixes whose active route the kernel rejected. |
bgp_kernel_route_changes_total{change} |
Counter | Number of changes requested from the kernel, by kind: install, remove. |
bgp_kernel_errors_total |
Counter | Number of requests that the kernel rejected. |
Build Metrics
| Metric | Type | Description |
|---|---|---|
bgp_build_info{version} |
Gauge | Always 1. The version label contains the running version. |