# More auths in 0.23 snmp\_exporter

**URL:** <https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804>\
**Category:** Exporters and Metrics\
**Created:** [August 10, 2023, 7:56am UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804 "2023-08-10T07:56:37Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom.i](https://avatars.discourse-cdn.com/v4/letter/t/5e9695/32.png) [@tom.i](https://discuss.prometheus.io/u/tom.i)\
**Post date:** [August 10, 2023, 7:56am UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804/1 "2023-08-10T07:56:37Z")

</div>

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

```auto
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:**

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

```

result: not possible **Two same public\_v2 names**

**TEST2:**  
v2 + v3

```auto
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`

---

<div class="post-metadata">

**Author:** ![SuperQ](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/superq/32/4_2.png) [@SuperQ](https://discuss.prometheus.io/u/SuperQ)\
**Post date:** [August 11, 2023, 12:42pm UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804/2 "2023-08-11T12:42:28Z")

</div>

> **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`.

---

<div class="post-metadata">

**Author:** ![tom.i](https://avatars.discourse-cdn.com/v4/letter/t/5e9695/32.png) [@tom.i](https://discuss.prometheus.io/u/tom.i)\
**Post date:** [August 11, 2023, 12:55pm UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804/3 "2023-08-11T12:55:06Z")

</div>

You mean in `modules`?

---

<div class="post-metadata">

**Author:** ![tom.i](https://avatars.discourse-cdn.com/v4/letter/t/5e9695/32.png) [@tom.i](https://discuss.prometheus.io/u/tom.i)\
**Post date:** [August 15, 2023, 7:26am UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804/4 "2023-08-15T07:26:51Z")

</div>

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

```auto
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…

```auto
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.

---

<div class="post-metadata">

**Author:** ![tom.i](https://avatars.discourse-cdn.com/v4/letter/t/5e9695/32.png) [@tom.i](https://discuss.prometheus.io/u/tom.i)\
**Post date:** [August 16, 2023, 8:41am UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804/5 "2023-08-16T08:41:09Z")

</div>

OMG… how stupid am I 🙂  
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 ☹

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](https://github.com/prometheus/snmp_exporter/blob/main/README.md#prometheus-configuration))

```auto
- 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]

```

---

<div class="post-metadata">

**Author:** ![SuperQ](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/superq/32/4_2.png) [@SuperQ](https://discuss.prometheus.io/u/SuperQ)\
**Post date:** [August 16, 2023, 9:53am UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804/6 "2023-08-16T09:53:31Z")

</div>

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

> [@tom.i](#):
>
> ```auto
> - job_name: 'snmp-brocade'
> static_configs:
> - targets:
> - 192.168.1.2 # Brocade SNMP device.
> metrics_path: /snmp
> params:
> auth: [auth_brocade]
> module: [if_mib]
> 
> ```

---

<div class="post-metadata">

**Author:** ![Nani](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/nani/32/807_2.png) [@Nani](https://discuss.prometheus.io/u/Nani)\
**Post date:** [September 12, 2023, 3:29am UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804/7 "2023-09-12T03:29:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![0xhessam](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.prometheus.io/0xhessam/32/830_2.png) [@0xhessam](https://discuss.prometheus.io/u/0xhessam)\
**Post date:** [October 18, 2023, 12:57pm UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804/8 "2023-10-18T12:57:00Z")

</div>

I also have this issue!

I have multiple vendors and multiple authenticates!

auths:  
dell\_snmpv3  
Lenovo\_snmpv3  
APC\_snmpv3

modules:  
dell  
lenovo  
APC

---

<div class="post-metadata">

**Author:** ![tom.i](https://avatars.discourse-cdn.com/v4/letter/t/5e9695/32.png) [@tom.i](https://discuss.prometheus.io/u/tom.i)\
**Post date:** [October 18, 2023, 1:11pm UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804/9 "2023-10-18T13:11:52Z")

</div>

Yes, you can add as many communities / authenticates as you want 😉

---

<div class="post-metadata">

**Author:** ![PaulButterworth](https://avatars.discourse-cdn.com/v4/letter/p/cdc98d/32.png) [@PaulButterworth](https://discuss.prometheus.io/u/PaulButterworth)\
**Post date:** [February 28, 2024, 4:02pm UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804/10 "2024-02-28T16:02:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PaulButterworth](https://avatars.discourse-cdn.com/v4/letter/p/cdc98d/32.png) [@PaulButterworth](https://discuss.prometheus.io/u/PaulButterworth)\
**Post date:** [February 29, 2024, 10:39am UTC](https://discuss.prometheus.io/t/more-auths-in-0-23-snmp-exporter/1804/11 "2024-02-29T10:39:59Z")

</div>

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