Unknown index type IpAddress

48 views
Skip to first unread message

Chris McKean

unread,
Mar 25, 2020, 5:39:11 AM3/25/20
to Prometheus Users
Hi All,
      I'm trying to get the snmp exporter working so I can get BGP peer state metrics off our routers.  It works locally on my machine but when I run the same config on the server I need this to run on it doesn't work.  So there's obviously some config I'm missing on the server.  I don't think, it's the MIB file that's missing.  If I run snmptranslate and specify the MIB is brings back a numerical value as expected

snmptranslate -m BGP4-MIB -IR -On bgpPeerState 

.1.3.6.1.2.1.15.3.1.2

When I try and query the 'bgp4' module this is the output I get.  


level=info ts=2020-03-24T10:53:35.919Z caller=main.go:149 msg="Starting snmp_exporter" version="(version=0.17.0, branch=HEAD, revision=f0ad4551a5c2023e383bc8dde2222f47dc760b83)"
level=info ts=2020-03-24T10:53:35.919Z caller=main.go:150 build_context="(go=go1.13.8, user=root@cb51f17d52f8, date=20200217-09:26:25)"
level=info ts=2020-03-24T10:53:35.932Z caller=main.go:243 msg="Listening on address" address=:9117
panic: Unknown index type IpAddress

goroutine 29 [running]:
main.indexOidsAsString(0xc00032e1d0, 0x4, 0x6, 0xc0001da840, 0x9, 0x0, 0x415800, 0x7fb91dc8fa00, 0x300, 0x7fb91de76fff, ...)
/app/collector.go:665 +0x1870
main.indexesToLabels(0xc00032e1d0, 0x4, 0x6, 0xc00021b280, 0xc00027da80, 0x8001c00027d928)
/app/collector.go:676 +0x169
main.pduToSamples(0xc00032e1d0, 0x4, 0x6, 0xc00027dab0, 0xc00021b280, 0xc00027da80, 0xabee20, 0xc000252360, 0x0, 0x0, ...)
/app/collector.go:329 +0x77
main.collector.Collect(0xaca540, 0xc000098dc0, 0xc0000ca651, 0xb, 0xc000124d20, 0xabee20, 0xc000252360, 0xc000095020)
/app/collector.go:247 +0x934


Has anyone any idead on this.  The server is running Centos 7.5 with netsnmp installed.

Here is the section of the bgp4 module on in the snmp.yml file


bgp4:
auth:
community: "xxxxxxxxx"
version: 2
walk:
- 1.3.6.1.2.1.15.2
- 1.3.6.1.2.1.15.3
metrics:
- name: bgpLocalAs
oid: 1.3.6.1.2.1.15.2
- name: bgpPeerState
oid: 1.3.6.1.2.1.15.3.1.2
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerAdminStatus
oid: 1.3.6.1.2.1.15.3.1.3
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerNegotiatedVersion
oid: 1.3.6.1.2.1.15.3.1.4
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerLocalPort
oid: 1.3.6.1.2.1.15.3.1.6
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerRemotePort
oid: 1.3.6.1.2.1.15.3.1.8
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerRemoteAs
oid: 1.3.6.1.2.1.15.3.1.9
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerInUpdates
oid: 1.3.6.1.2.1.15.3.1.10
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerOutUpdates
oid: 1.3.6.1.2.1.15.3.1.11
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerInTotalMessages
oid: 1.3.6.1.2.1.15.3.1.12
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerOutTotalMessages
oid: 1.3.6.1.2.1.15.3.1.13
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerFsmEstablishedTransitions
oid: 1.3.6.1.2.1.15.3.1.15
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerFsmEstablishedTime
oid: 1.3.6.1.2.1.15.3.1.16
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerConnectRetryInterval
oid: 1.3.6.1.2.1.15.3.1.17
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerHoldTime
oid: 1.3.6.1.2.1.15.3.1.18
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerKeepAlive
oid: 1.3.6.1.2.1.15.3.1.19
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerHoldTimeConfigured
oid: 1.3.6.1.2.1.15.3.1.20
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerKeepAliveConfigured
oid: 1.3.6.1.2.1.15.3.1.21
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerMinASOriginationInterval
oid: 1.3.6.1.2.1.15.3.1.22
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerMinRouteAdvertisementInterval
oid: 1.3.6.1.2.1.15.3.1.23
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7
- name: bgpPeerInUpdateElapsedTime
oid: 1.3.6.1.2.1.15.3.1.24
indexes:
- labelname: bgpPeerIdentifier
type: IpAddress
lookups:
- labels: [bgpPeerIdentifier]
labelname: bgpPeerRemoteAddr
oid: 1.3.6.1.2.1.15.3.1.7

Chris McKean

unread,
Mar 25, 2020, 5:40:08 AM3/25/20
to Prometheus Users
Sorry, this is for the snmp_exporter here

Brian Candler

unread,
Mar 25, 2020, 6:57:15 AM3/25/20
to Prometheus Users
How did you create the snmp.yml - using generator, or by hand?

In the sample configs I see "type: InetAddress" and "type: InetAddressIPv4", but not "type: IpAddress"

Notice the following in generator/README.md:

         type: DisplayString # Override the metric type, possible types are:
                             #   gauge:   An integer with type gauge.
                             #   counter: An integer with type counter.
                             #   OctetString: A bit string, rendered as 0xff34.
                             #   DateAndTime: An RFC 2579 DateAndTime byte sequence. If the device has no time zone data, UTC is used.
                             #   DisplayString: An ASCII or UTF-8 string.
                             #   PhysAddress48: A 48 bit MAC address, rendered as 00:01:02:03:04:ff.
                             #   Float: A 32 bit floating-point value with type gauge.
                             #   Double: A 64 bit floating-point value with type gauge.
                             #   InetAddressIPv4: An IPv4 address, rendered as 1.2.3.4.
                             #   InetAddressIPv6: An IPv6 address, rendered as 0102:0304:0506:0708:090A:0B0C:0D0E:0F10.
                             #   InetAddress: An InetAddress per RFC 4001. Must be preceded by an InetAddressType.
                             #   InetAddressMissingSize: An InetAddress that violates section 4.1 of RFC 4001 by
                             #       not having the size in the index. Must be preceded by an InetAddressType.
                             #   EnumAsInfo: An enum for which a single timeseries is created. Good for constant values.
                             #   EnumAsStateSet: An enum with a time series per state. Good for variable low-cardinality enums.
                             #   Bits: An RFC 2578 BITS construct, which produces a StateSet with a time series per bit.

I don't see "IpAddress" in that list.  Where did it come from?

On Wednesday, 25 March 2020 09:39:11 UTC, Chris McKean wrote:
Hi All,
      I'm trying to get the snmp exporter working so I can get BGP peer state metrics off our routers.  It works locally on my machine but when I run the same config on the server I need this to run on it doesn't work.

Define "works locally" versus "doesn't work" - exactly what do you see on the local machine, as compared to what you see when deployed on the server?

I would suggest at very least you need to test both machines with curl, e.g.

curl 'localhost:9117/snmp?module=bgp4&target=x.x.x.x'

Run this both on the local machine and on the server, and use the same target in both cases.  What's the difference in behaviour?

Are you using the same version of snmp_exporter on both the local machine and the server?  That's the only thing I can think of which would have any effect.

However, I'm not yet convinced of your claim that the snmp.yml you've shown actually works on the local machine.


 
  So there's obviously some config I'm missing on the server.  I don't think, it's the MIB file that's missing.  If I run snmptranslate and specify the MIB is brings back a numerical value as expected


The running snmp_exporter doesn't need MIBs, nor does it need any part of net-snmp to be present.  It's only the generator which needs this.  snmp_exporter just reads the YAML file, nothing else.


When I try and query the 'bgp4' module this is the output I get.  


level=info ts=2020-03-24T10:53:35.919Z caller=main.go:149 msg="Starting snmp_exporter" version="(version=0.17.0, branch=HEAD, revision=f0ad4551a5c2023e383bc8dde2222f47dc760b83)"
level=info ts=2020-03-24T10:53:35.919Z caller=main.go:150 build_context="(go=go1.13.8, user=root@cb51f17d52f8, date=20200217-09:26:25)"
level=info ts=2020-03-24T10:53:35.932Z caller=main.go:243 msg="Listening on address" address=:9117
panic: Unknown index type IpAddress


Does the panic occur as soon as snmp_exporter starts up?  Or only when you send the query, e.g. with curl as above?

 
goroutine 29 [running]:
main.indexOidsAsString(0xc00032e1d0, 0x4, 0x6, 0xc0001da840, 0x9, 0x0, 0x415800, 0x7fb91dc8fa00, 0x300, 0x7fb91de76fff, ...)
/app/collector.go:665 +0x1870
main.indexesToLabels(0xc00032e1d0, 0x4, 0x6, 0xc00021b280, 0xc00027da80, 0x8001c00027d928)
/app/collector.go:676 +0x169
main.pduToSamples(0xc00032e1d0, 0x4, 0x6, 0xc00027dab0, 0xc00021b280, 0xc00027da80, 0xabee20, 0xc000252360, 0x0, 0x0, ...)
/app/collector.go:329 +0x77
main.collector.Collect(0xaca540, 0xc000098dc0, 0xc0000ca651, 0xb, 0xc000124d20, 0xabee20, 0xc000252360, 0xc000095020)
/app/collector.go:247 +0x934


Has anyone any idead on this.  The server is running Centos 7.5 with netsnmp installed.


And what's the local machine, where (apparently) it works?

Chris McKean

unread,
Mar 26, 2020, 6:29:11 AM3/26/20
to Prometheus Users
Hi Brian,
     Thank you for your reply.  I had hand generated this file.  I have now used the generator and its working.  I did go back and change IpAddress to InetAddressIPv4 in the manual version and that would work also.

--
Cheers

Chris
Reply all
Reply to author
Forward
0 new messages