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 <https://github.com/prometheus/snmp_exporter/blob/master/generator/README.md#file-format> : 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* > *github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1() > <http://github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()>* > * > /app/vendor/github.com/prometheus/client_golang/prometheus/registry.go:443 > <http://github.com/prometheus/client_golang/prometheus/registry.go:443> > +0x19d* > *created by > github.com/prometheus/client_golang/prometheus.(*Registry).Gather > <http://github.com/prometheus/client_golang/prometheus.(*Registry).Gather>* > * > /app/vendor/github.com/prometheus/client_golang/prometheus/registry.go:454 > <http://github.com/prometheus/client_golang/prometheus/registry.go:454> > +0x57d* > > > 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? -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/e318c229-2ba4-4b78-9b99-90fc8770f088%40googlegroups.com.

