prometheus / snmp_exporter

SNMP Exporter for Prometheus
Apache License 2.0
1.65k stars 614 forks source link

Generated snmp.yml cannot be unmarshalled by snmp exporter #922

Closed adminsend closed 1 year ago

adminsend commented 1 year ago

SNMP exporter has trouble parsing snmp.ymlö, generated by generator: snmp.yml is generated from the default generator.yml, without any modificaitons.

ts=2023-07-18T21:11:17.245Z caller=main.go:153 level=info build_context="(go=go1.18.1, user=team+pkg-go@tracker.debian.org, date=20230203-14:12:28)" ts=2023-07-18T21:11:17.408Z caller=main.go:159 level=error msg="Error parsing config file" err="yaml: unmarshal errors:\n line 3: field public_v1 not found in type config.plain\n line 9: field public_v2 not found in type config.plain\n line 16: field apcups not found in type config.plain\n line 2374: field arista_sw not found in type config.plain\n line 2949: field cisco_wlc not found in type config.plain\n line 3395: field cyberpower not found in type config.plain\n line 6007: field ddwrt not found in type config.plain\n line 6442: field if_mib not found in type config.plain\n line 7699: field infrapower_pdu not found in type config.plain\n line 7777: field keepalived not found in type config.plain\n line 9633: field kemp_loadmaster not found in type config.plain\n line 10396: field liebert_pdu not found in type config.plain\n line 12902: field mikrotik not found in type config.plain\n line 16180: field nec_ix not found in type config.plain\n line 18459: field paloalto_fw not found in type config.plain\n line 19548: field printer_mib not found in type config.plain\n line 19751: field raritan not found in type config.plain\n line 19878: field servertech_sentry3 not found in type config.plain\n line 20407: field servertech_sentry4 not found in type config.plain\n line 22740: field synology not found in type config.plain\n line 24516: field ubiquiti_airfiber not found in type config.plain\n line 25701: field ubiquiti_airmax not found in type config.plain\n line 26345: field ubiquiti_unifi not found in type config.plain\n line 26974: field wiener_mpod not found in type config.plain\n line 49218: cannot unmarshal !!int 2 into config.plain"

Host operating system: output of uname -a

Linux srv-adh-vm-0084 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

snmp_exporter version: output of snmp_exporter -version

snmp_exporter" version="(version=0.20.0, branch=debian/sid, revision=0.20.0-1ubuntu0.1)"

What did you do that produced an error?

running snmp exporter

What did you expect to see?

startup and correct parsing of exporter

What did you see instead?

errormessage as shown above

SuperQ commented 1 year ago

You haven't included the config that caused the problem.

calebarcher commented 1 year ago

I have the exact same problem. Here's my config generator.yml `--- version: 2

auths: with_secret: version: 3 username: uname security_level: authNoPriv password: pass auth_protocol: SHA
priv_protocol: AES256
priv_password: privpass context_name: context

modules:

IF-MIB: walk: [sysUpTime, interfaces, ifXTable] retries: 3
timeout: 10s
lookups:

I'm using version 0.22.0 of the snmp exporter. The generator generates the snmp.yml file without any errors but when I start the snmp exporter using the file, I get the the error

calebarcher commented 1 year ago

I just figured what my issue was, the version of snmp exporter was different from version of generator i was using. They have to be the same version

adminsend commented 1 year ago

Agreed, i came to the same conclusion. generator and snmp-exporter must have the same version. IMHO this should be mentioned somewhere. ;)