prometheus / prometheus/snmp_exporter

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

Open
#1,237 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
2.2k
Forks
747
Avg merge
2d 4h
Merged PRs (30d)
9

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two Docker invocations shown and trace how --web.listen-address and the default --config.file are handled. Done means setting an explicit listen address still loads the default configuration file without requiring --config.file; the issue names no source files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.