From bbf0f39107b705ef33dcf16bccd1c6ad33232fa4 Mon Sep 17 00:00:00 2001 From: netixx Date: Thu, 22 Feb 2024 17:53:35 +0100 Subject: [PATCH] [stayrtr] add a metric for current serial number --- cmd/stayrtr/stayrtr.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/stayrtr/stayrtr.go b/cmd/stayrtr/stayrtr.go index 2c59882..7b0a6dc 100644 --- a/cmd/stayrtr/stayrtr.go +++ b/cmd/stayrtr/stayrtr.go @@ -143,6 +143,12 @@ var ( }, []string{"type"}, ) + CurrentSerial = prometheus.NewGauge( + prometheus.GaugeOpts{ + Name: "rtr_serial", + Help: "Current serial.", + }, + ) protoverToLib = map[int]uint8{ 0: rtr.PROTOCOL_VERSION_0, @@ -159,6 +165,7 @@ func initMetrics() { prometheus.MustRegister(RefreshStatusCode) prometheus.MustRegister(ClientsMetric) prometheus.MustRegister(PDUsRecv) + prometheus.MustRegister(CurrentSerial) } func metricHTTP() { @@ -453,6 +460,7 @@ func (s *state) applyUpdateFromNewState(vrps []rtr.VRP, brks []rtr.BgpsecKey, va log.Debugf("Sending notifications to clients") s.server.NotifyClientsLatest() } + CurrentSerial.Set(float64(serial)) s.lockJson.Lock() s.exported = prefixfile.RPKIList{