goarista
goarista copied to clipboard
ocprometheus fails with duplicated metrics with EOS 4.27
Using latest goarista from master branch, EOS 4.27.4M, and a configuration like this:
metrics:
- name: ocprometheus_bgp_peer_as_number #No unit
path: /Sysdb/routing/bgp/export/vrfBgpPeerInfoStatusEntryTable/(?P<vrf>.+)/bgpPeerInfoStatusEntry/(?P<name>.+)/bgpPeerAs
help: BGP Peer AS Number
ocprometheus fails with errors like this:
* collected metric "ocprometheus_bgp_peer_as_number" { label:<name:"name" value:"192.168.247.17" > label:<name:"vrf" value:"default" > gauge:<value:0 > } was collected before with the same name and label values
This used to work so far with EOS <= 4.26.6M :
ocprometheus_bgp_peer_as_number{name="10.64.226.33/bgpPeerSessionStatus",vrf="default"} 1234
ocprometheus_bgp_peer_as_number{name="10.64.226.35/bgpPeerSessionStatus",vrf="default"} 1234
ocprometheus_bgp_peer_as_number{name="192.168.247.19/bgpPeerSessionStatus",vrf="default"} 64850
ocprometheus_bgp_peer_as_number{name="192.168.248.19/bgpPeerSessionStatus",vrf="default"} 64850
It looks like the name "(?P
workaround for my use case is to replace
path: /Sysdb/routing/bgp/export/vrfBgpPeerInfoStatusEntryTable/(?P<vrf>.+)/bgpPeerInfoStatusEntry/(?P<name>.+)/bgpPeerAs
with
path: /Sysdb/routing/bgp/export/vrfBgpPeerInfoStatusEntryTable/(?P<vrf>.+)/bgpPeerInfoStatusEntry/(?P<name>.+)/bgpPeerSessionStatus/bgpPeerAs
so a single bgpPeerAs is found and there is no path included in "name".