Download raw body.
bgpctl: use fmt_peer for the description value of neighbor metrics
Use fmt_peer() the fill out the description field in the peer attributes.
With this peers with no description will use the IP address instead.
With this the description label in prometheus can always show the name of
the peer.
The same is used in json or regular output.
--
:wq Claudio
Index: output_ometric.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpctl/output_ometric.c,v
diff -u -p -r1.14 output_ometric.c
--- output_ometric.c 20 Feb 2025 19:48:14 -0000 1.14
+++ output_ometric.c 29 Oct 2025 20:01:19 -0000
@@ -176,14 +176,18 @@ ometric_neighbor_stats(struct peer *p, s
const char *keys[5] = {
"remote_addr", "remote_as", "description", "group", NULL };
const char *values[5];
+ char *descr;
/* skip neighbor templates */
if (p->conf.template)
return;
+ descr = fmt_peer(p->conf.descr, &p->conf.remote_addr,
+ p->conf.remote_masklen);
+
values[0] = log_addr(&p->conf.remote_addr);
values[1] = log_as(p->conf.remote_as);
- values[2] = p->conf.descr;
+ values[2] = descr;
values[3] = p->conf.group;
values[4] = NULL;
@@ -249,6 +253,7 @@ ometric_neighbor_stats(struct peer *p, s
ometric_set_int(peer_rr_eorr_receive, p->stats.refresh_rcvd_eorr, ol);
olabels_free(ol);
+ free(descr);
}
static void
bgpctl: use fmt_peer for the description value of neighbor metrics