Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure many SNMP authentication method in the same snmp.yml #984

Closed
balioune opened this issue Sep 1, 2023 · 3 comments
Closed

Configure many SNMP authentication method in the same snmp.yml #984

balioune opened this issue Sep 1, 2023 · 3 comments

Comments

@balioune
Copy link

balioune commented Sep 1, 2023

Hi all,
I'm using snmp_exporter to to monitor my routers. some of my routers use SNMP v2 and others SNMP v3.
I would like to know how to set the SNMP v2 community and credential of SNMP v3 in the same snmp.yml ?
The ideal is to have all authentication method in the same configuration file.

BR

@candlerb
Copy link
Contributor

candlerb commented Sep 1, 2023

Splitting out of auth creds has been available since snmp_exporter 0.23.0 The file auth-split-migration.md explains how to use it.

At scrape time you have to provide target, module and auth query params. These can come directly from your targets file, e.g.

- labels:
    __param_auth: auth1
    __param_module: if_mib
  targets:
    - 1.1.1.1
    - 2.2.2.2
- labels:
    __param_auth: auth2
    __param_module: if_mib
  targets:
    - 3.3.3.3
    - 4.4.4.4

or, in more sophisticated configs, from relabelling rules.

Also, as of 0.24.0 you can have multiple configuration files which are merged together, each of which can contain modules, auths, or both. You do this using repeated --config.file arguments, and/or by providing a glob pattern like --config.file=/etc/prometheus/snmp.d/*.yml

@balioune
Copy link
Author

balioune commented Sep 1, 2023

Thanks so much @candlerb . this solves my issues
BR,

@candlerb
Copy link
Contributor

candlerb commented Sep 1, 2023

Great, can you close the issue please? (Aside: I've just discovered "Discussions" are enabled on this repo)

@balioune balioune closed this as completed Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants