You simply copy-paste what Ben showed. To extend it slightly for clarity:
version: 2
auths:
prod_router:
version: 3
security_level: authPriv
username: admin
auth_protocol: SHA
password: tcpip123
priv_protocol: AES
priv_password: xyzzy
modules:
....
"version: 2" at the top of the file, refers to the config file version.
This is version 2 of the config file: that is, the new format which has
separate "modules" and "auths" sections.
Under "auths", and below a named auth section like "prod_router" in the
example above, "version: 3" refers to the SNMP version.
On Tuesday, 18 July 2023 at 21:06:47 UTC+1 Felipe Oliveira do Rosario wrote:
>
> Hi Ben, i don't know if i understood well, you can explain for me please?
> Where i localize the config version ? What i need to do for use the snmpv3
> correctly ?
> On Monday, July 17, 2023 at 5:16:24 PM UTC-3 Ben Kochie wrote:
>
>> Config version is a top level key for the new generator/exporter config
>> formats. It's unrelated to SNMP protocol versions.
>>
>> # The generator config format version.
>> version: 2
>> auths:
>> v3:
>> version: 3
>> ...
>> modules:
>> ...
>>
>> On Mon, Jul 17, 2023 at 10:13 PM 'Felipe Oliveira do Rosario' via
>> Prometheus Users <[email protected]> wrote:
>>
>>> Hi everyone, I'm trying to use generator.yaml for Juniper or Fortigate
>>> and with version 3 I'm getting the following error:
>>>
>>> ts=2023-07-17T18:14:53.048Z caller=main.go:136 level=error msg="Error
>>> generating config netsnmp" err="unsupported config version"
>>>
>>> Honestly, I don't know where I'm going wrong, I would like your help
>>> because with this same configuration using version 2 I can generate the
>>> snmp.yaml as expected for both Juniper and Fortigate, Cisco, etc, but for
>>> security reasons I need to use snmpv3, and when I try to use it I always
>>> get the same error.. can you please help me? Follow my example file!
>>> At first I thought it was the indentation, but it's not because with
>>> versions 1 and 2 it works normally.
>>>
>>> Note: Remembering that all my devices already have snmp enabled!
>>> ---
>>> # The generator config format version.
>>> auths:
>>> v3:
>>> version: 3
>>> username: xxxx
>>> password: xxxx
>>> auth_protocol: SHA
>>> priv_protocol: AES
>>> security_level: authPriv
>>> priv_password: xxxx
>>>
>>> modules:
>>> juniper:
>>> walk: [sysUpTime, interfaces, ifXTable]
>>> lookups:
>>> - source_indexes: [ifIndex]
>>> lookup: ifAlias
>>> - source_indexes: [ifIndex]
>>> lookup: 1.3.6.1.2.1.2.2.1.2
>>> - source_indexes: [ifIndex]
>>> lookup: 1.3.6.1.2.1.31.1.1.1.1
>>> overrides:
>>> ifAlias:
>>> ignore: true
>>> ifDescr:
>>> ignore: true
>>> ifName:
>>> ignore: true
>>> ifType:
>>> type: EnumAsInfo
>>>
>>> --
>>> 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/92045a3a-7a58-4d3d-befd-b95769a82ea2n%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/prometheus-users/92045a3a-7a58-4d3d-befd-b95769a82ea2n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
--
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/ae22212e-eb42-4a1d-93f1-9020aee9b685n%40googlegroups.com.