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

Default value for config.file not honored with explicit web.listen-address #1237

Open
jtougas opened this issue Aug 26, 2024 · 2 comments
Open

Comments

@jtougas
Copy link

jtougas commented Aug 26, 2024

It seems that adding the --web.listen-address without also setting --config.file fails to correctly read the default configuration file.

In other words both or neither need to be set for things to work. If only --web.listen-address is set:

curl "http://127.0.0.1:9116/snmp?auth=auth-5&module=foo&target=127.0.0.1"
Unknown auth 'auth-5'

We've been running it in docker like this:

docker run -it --rm \
-v /etc/snmp-exporter:/etc/snmp_exporter:ro \
--network=host \
prom/snmp-exporter:v0.25.0

and we hit this problem when adding --web.listen-address like this:

docker run -it --rm \
-v /etc/snmp-exporter:/etc/snmp_exporter:ro \
--network=host \
prom/snmp-exporter:v0.25.0 \
--web.listen-address=127.0.0.1:9116

workaround like this:

docker run -it --rm \
-v /etc/snmp-exporter:/etc/snmp_exporter:ro \
--network=host prom/snmp-exporter:v0.25.0 \
--web.listen-address=127.0.0.1:9116 \
--config.file /etc/snmp_exporter/snmp.yml

This isn't a big problem in my case as I can simply set --config.file and be done with it. It took me a while of head scratching to figure this out though.

@Vandit1604
Copy link

I tried using your workaround but it didn't work

docker run -it --rm \
-v /etc/snmp-exporter:/etc/snmp_exporter:ro \
--network=host prom/snmp-exporter:v0.25.0 \
--web.listen-address=127.0.0.1:9116 \
--config.file /etc/snmp_exporter/snmp.yml
curl "http://127.0.0.1:9116/snmp?auth=auth-5&module=foo&target=127.0.0.1"
Unknown auth 'auth-5'

Can you share your config here for further investigation?

@jtougas
Copy link
Author

jtougas commented Sep 20, 2024

auth-5 must be present in the config file:

auths:
  auth-5:
    community: foo
    security_level: noAuthNoPriv
    auth_protocol: MD5
    priv_protocol: DES
    version: 2

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