Hi,I have compiled generator that comes with snmp exporter on my ubuntu container. I can successfully generate metrics settings from MIB files. But I could not figure out the details.1. Where are the MIB files referred to by generator? (Where should I put additional extended/enterprise mib files?)I was wondering where I should put additional extended mibs (1.3.6.1.4.1.X). I can find mib files at /usr/share/mibs(link to /var/lib/mibs), which seemed to be downloaded while installing snmp-mibs-downloader. I assumed generator refers to this directory. Is this true and I am recommended to put extended mibs here?
2. Where can I find logs about generater?Following log message is shown while generating snmp.yml:WARN[0000] NetSNMP reported 9 parse errors source=main.go:75I can find the parse errors NetSNMP reported. What I want to do is to prove snmp.yml contains correct metrics setting. Which mib files were used, which SNMP object was written or dropped, and so forth.
--
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 prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/ead86b49-8afd-44c1-9f97-a7238643c5ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You can put them wherever netsmp will read them from.
That requires manual verification, logs wouldn't help you here.
--
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 prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/de9083b4-9eae-4c29-adba-b49f4eaacdb2%40googlegroups.com.
I have a generator.yml as follows:
--------
modules:
vyos:
walk:
- 1.3.6.1.2.1.2.2.1.4
lookups:
- old_index: ifIndex
new_index: ifDescr
--------
where 1.3.6.1.2.1.2.2.1.4 is ifMtu defined in IF-MIB.
I executed 'generator generate' command.
--------
root@9064bddcf637:~/go/bin# generator generate
WARN[0000] NetSNMP reported 1 parse errors source=main.go:75
INFO[0000] Generating config for module vyos source=main.go:29
INFO[0000] Generated 1 metrics for module vyos source=main.go:33
INFO[0000] Config written to snmp.yml source=main.go:55
--------
I get snmp.yml as follows:
--------
vyos:
walk:
- 1.3.6.1.2.1.2.2.1.2
- 1.3.6.1.2.1.2.2.1.4
metrics:
- name: ifMtu
oid: 1.3.6.1.2.1.2.2.1.4
indexes:
- labelname: ifDescr
type: Integer
lookups:
- labels:
- ifDescr
labelname: ifDescr
oid: 1.3.6.1.2.1.2.2.1.2
--------
I get an error when accessing at http://snmp_exporter:9116/snmp?module=vyos&target=target_device
--------
An error has occurred during metrics gathering:
collected metric ifMtu untyped:<value:9001 > was collected before with the same name and label values
--------
I replaced 'type: Integer' in snmp.yml with 'type: Integer32' then it worked
--------
# HELP ifMtu
# TYPE ifMtu untyped
ifMtu{ifDescr="eth0"} 9001
ifMtu{ifDescr="lo"} 65536
--------
This is 'generator dump' output:
--------
1.3.6.1.2.1.2.2.1.4 ifMtu INTEGER32 [ifIndex] The size of the largest packet which can be sent/received on the interface, specified in octets
--------
I cannot figure out how to generate snmp.yml with Integer32 instead of Integer. I appreciate any help.
--------
I replaced 'type: Integer' in snmp.yml with 'type: Integer32' then it worked
--------
# HELP ifMtu
# TYPE ifMtu untyped
ifMtu{ifDescr="eth0"} 9001
ifMtu{ifDescr="lo"} 65536
--------
This is 'generator dump' output:
--------
1.3.6.1.2.1.2.2.1.4 ifMtu INTEGER32 [ifIndex] The size of the largest packet which can be sent/received on the interface, specified in octets
--------
I cannot figure out how to generate snmp.yml with Integer32 instead of Integer. I appreciate any help.
--
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 prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/8b540579-8b49-4296-a2c9-459631f42277%40googlegroups.com.
ifDesc is non-unique, you can't use it as a lookup. Try the just-merged string support to handle this.
modules:
vyos:
walk
vyos:
walk:
- 1.3.6.1.2.1.2.2.1.4
metrics:
- name: ifMtu
oid: 1.3.6.1.2.1.2.2.1.4
indexes:
- labelname: ifIndex
type: Integer
-- error from snmp exporter --
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
Sorry if I misunderstood your comment.
ifDesc is non-unique, you can't use it as a lookup. Try the just-merged string support to handle this.I get same error with generator.yml without lookup:
-- generator.yml --modules:
vyos:
walk
- 1.3.6.1.2.1.2.2.1.4-- snmp.yml --vyos:
walk:
- 1.3.6.1.2.1.2.2.1.4
metrics:
- name: ifMtu
oid: 1.3.6.1.2.1.2.2.1.4
indexes:
- labelname: ifIndex
type: Integer
-- error from snmp exporter --
An error has occurred during metrics gathering:collected metric ifMtu untyped:<value:9001 > was collected before with the same name and label values-- ifDesc --$ snmpwalk -v 2c -c prom 172.31.48.226 1.3.6.1.2.1.2.2.1.2IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
Sorry if I misunderstood your comment.
--
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 prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/4841a255-cf05-45e8-b694-a63146e261b8%40googlegroups.com.
Are you sure that's the config the snmp_exporter is using?
Yes.
# cat generator.yml
modules:
vyos:
walk:
- 1.3.6.1.2.1.2.2.1.4
# generator generate
WARN[0000] NetSNMP reported 1 parse errors source=main.go:75
INFO[0000] Generating config for module vyos source=main.go:29
INFO[0000] Generated 1 metrics for module vyos source=main.go:33
INFO[0000] Config written to snmp.yml source=main.go:55
# cat snmp.yml
vyos:
walk:
- 1.3.6.1.2.1.2.2.1.4
metrics:
- name: ifMtu
oid: 1.3.6.1.2.1.2.2.1.4
indexes:
- labelname: ifIndex
type: Integer
$ docker exec -it snmp-exporter3 /bin/ash
/ # cat /etc/snmp_exporter/snmp.yml
---
# Default module: interface stats and uptime.
vyos:
version: 2
auth:
community: xxxx
I have been using docker container from prom/snmp_exporter. I reconstructed snmp_exporter from the latest source code without using prom/snmp_exporter container. Then, ifMtu shows up correctly without lookups.
--- snmp.yml ---
vyos:
version: 2
auth:
community: prom
walk:
- 1.3.6.1.2.1
metrics:
- name: ifMtu
oid: 1.3.6.1.2.1.2.2.1.4
type: gauge
indexes:
- labelname: ifIndex
type: Integer
--- browser output ---
# HELP ifMtu
# TYPE ifMtu gauge
ifMtu{ifIndex="1"} 65536
ifMtu{ifIndex="2"} 9001
But same issue happens with other metrics and latest source code.
--- snmp.yml ---
vyos:
version: 2
auth:
community: prom
walk:
- 1.3.6.1.2.1
metrics:
- name: tcpConnLocalPort
oid: 1.3.6.1.2.1.6.13.1.3
type: gauge
indexes:
- labelname: tcpConnLocalAddress
type: IpAddr
- labelname: tcpConnLocalPort
type: Integer
- labelname: tcpConnRemAddress
type: IpAddr
- labelname: tcpConnRemPort
type: Integer
--- browser Output ---
An error has occurred during metrics gathering:
6 error(s) occurred:
* collected metric tcpConnLocalPort label:<name:"tcpConnLocalPort" value:"127" > label:<name:"tcpConnRemPort" value:"0" > gauge:<value:199 > was collected before with the same name and label values
* collected metric tcpConnLocalPort label:<name:"tcpConnLocalPort" value:"127" > label:<name:"tcpConnRemPort" value:"0" > gauge:<value:199 > was collected before with the same name and label values
* collected metric tcpConnLocalPort label:<name:"tcpConnLocalPort" value:"127" > label:<name:"tcpConnRemPort" value:"0" > gauge:<value:49108 > was collected before with the same name and label values
* collected metric tcpConnLocalPort label:<name:"tcpConnLocalPort" value:"127" > label:<name:"tcpConnRemPort" value:"0" > gauge:<value:49107 > was collected before with the same name and label values
* collected metric tcpConnLocalPort label:<name:"tcpConnLocalPort" value:"127" > label:<name:"tcpConnRemPort" value:"0" > gauge:<value:199 > was collected before with the same name and label values
* collected metric tcpConnLocalPort label:<name:"tcpConnLocalPort" value:"127" > label:<name:"tcpConnRemPort" value:"0" > gauge:<value:199 > was collected before with the same name and label values
--- snmpwalk result ---
$ snmpwalk -v 2c -c xxx x.x.x.x 1.3.6.1.2.1.6.13.1.3
TCP-MIB::tcpConnLocalPort.0.0.0.0.22.0.0.0.0.0 = INTEGER: 22
TCP-MIB::tcpConnLocalPort.127.0.0.1.199.0.0.0.0.0 = INTEGER: 199
TCP-MIB::tcpConnLocalPort.127.0.0.1.199.127.0.0.1.49107 = INTEGER: 199
TCP-MIB::tcpConnLocalPort.127.0.0.1.199.127.0.0.1.49108 = INTEGER: 199
TCP-MIB::tcpConnLocalPort.127.0.0.1.199.127.0.0.1.49109 = INTEGER: 199
TCP-MIB::tcpConnLocalPort.127.0.0.1.49107.127.0.0.1.199 = INTEGER: 49107
TCP-MIB::tcpConnLocalPort.127.0.0.1.49108.127.0.0.1.199 = INTEGER: 49108
TCP-MIB::tcpConnLocalPort.127.0.0.1.49109.127.0.0.1.199 = INTEGER: 49109