More auths in 0.23 snmp_exporter

How should I specify more auths in one generator.yml file?
Actually on 0.23.0-rc.1 I have generator.yml like:

auths:
  auth_cisco:
    version: 2
    community: BLABLA
  auth_checkpoint:
    version: 2
    community: BLABLA2
  auth_viptela:
    version: 3
    username: BLABLA3
    security_level: authPriv
    password: BLABLA4
    auth_protocol: SHA 
    priv_protocol: AES
    priv_password: BLABLA5
    context_name: context
modules:
...

When I generate snmp.yml and copy it to snmp_exporter and run it, when I execute snmp_exporter in web page, it shows me message:
Unknown auth ‘public_v2’
So it means, that I have to use just specific names for auths block? Like public_v1, public_v2 and public_v3?

I’ve tried to manage it by myself, and it looks, that more auths method is not possible. Especially v2 and v3 together.
TEST1:

auths:
  public_v2:
    version: 2
    community: BLABLA1
  public_v2:
    version: 2
    community: BLABLA2

result: not possible Two same public_v2 names

TEST2:
v2 + v3

auths:
  public_v2:
    version: 2
    community: BLABLA2
  public_v3:
    version: 3
    username: BLABLA3
    security_level: authPriv
    password: BLABLA4
    auth_protocol: SHA 
    priv_protocol: AES
    priv_password: BLABLA5
    context_name: context

result: snmp_exporter uses auth=public_v2 why??
caller=collector.go:218 level=debug auth=public_v2 module=viptela_mib target=10.128.XX.XXX msg="Walking subtree" oid=1.3.6.1.4.1.41916.3

Unknown auth ‘public_v2’

This means you did not specify any auth method. You forgot to include one of the auths you specified like auth_checkpoint.

You mean in modules?

@SuperQ - ok I’ve tried in generetaro from 0.23.rc-1 this:

auths:
  auth_cisco:
    version: 2
    community: BLA
  auth_checkpoint:
    version: 2
    community: BLA
  auth_brocade:
    version: 2
    community: Bla
  auth_viptela:
    version: 3
    username: BLE
    security_level: authPriv
    password: BLA
    auth_protocol: SHA
    priv_protocol: AES
    priv_password: BLA
#    context_name: contenxt

modules:
  cisco_mib:
    auth:
      name: auth_cisco
    walk:
....

but error appears of course…

ts=2023-08-15T07:19:56.001Z caller=main.go:122 level=warn msg="NetSNMP reported parse error(s)" errors=9
ts=2023-08-15T07:19:56.202Z caller=main.go:132 level=error msg="Error generating config netsnmp" err="error parsing yml config: yaml: unmarshal errors:\n  line 24: field auth not found in type main.plain"

How can I specify which auth method is used for each module please.

OMG… how stupid am I :slight_smile:
I was focused to fill up auths in generator.yml and snmp.yml somehow… that I missed that it should be added to prometheus.yml file :frowning:

It has to be filled in this section as it is written in manual (https://github.com/prometheus/snmp_exporter/blob/main/README.md#prometheus-configuration)

- job_name: 'snmp'
    static_configs:
      - targets:
        - 192.168.1.2  # SNMP device.
        - switch.local # SNMP device.
        - tcp://192.168.1.3:1161  # SNMP device using TCP transport and custom port.
    metrics_path: /snmp
    params:
      auth: [public_v2]
      module: [if_mib]

Yes, that’s it. If you wanted to use another auth entry like auth_brocade you would just change the group like this:

1 Like

so that mean prometheus can’t pull snmp-exporter with multi-communities in 1 time right ?

I also have this issue!

I have multiple vendors and multiple authenticates!

auths:
dell_snmpv3
Lenovo_snmpv3
APC_snmpv3

modules:
dell
lenovo
APC

Yes, you can add as many communities / authenticates as you want :wink:

Hi tom.i
I’m trying to set this up myself, having gone from monitoring one type of device with a community string configured through the snmp.yml to needing to monitor multiple types of device with different community strigns, and am struggling.

Can you share a screen shot of how you’ve added this to and gotten it working from your prometheus.yml file?

Cheers
Paul

Got there this morning, think I needed to look at it with fresh eyes!