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

Regression: alertmanager.url flag ignores basic auth #2344

Closed
bwplotka opened this Issue Jan 16, 2017 · 3 comments

Comments

Projects
None yet
1 participant
@bwplotka
Copy link
Contributor

bwplotka commented Jan 16, 2017

What did you do?

  • Upgraded Prometheus from 1.1.3 to 1.4.1

What did you expect to see?
I expect that Prometheus will still parse the flag in the same way it used to do in 1.1.3. Especially when docs discourages using alertmanager_config and recommends the "stable" alternative, which is just alertmanager.url flag.

Our -alertmanager.url flag is set to https://<login>:<password>@<static_url>. With this flag our Prometheus instances were able to reach alertmanager with basic auth encoded.

What did you see instead? Under which circumstances?
time="2017-01-16T12:47:40Z" level=error msg="Error sending alerts: bad response status 401 Unauthorized" alertmanager="https://<static_url>:443/api/v1/alerts" count=1 source="notifier.go:335"

Clearly no basic auth is provided.

I can see that here https://github.com/prometheus/prometheus/blob/master/cmd/prometheus/main.go#L271 u.User data is just ignored (where the basic auth is). Previously whole -alertmanager.url url was just used.

Mitigation
Changing from flag to alertmanager_config with filled basic_auth options and removing flag obviously helped alert are propagating.

Second issue is that when both flag and alertmanager_config was specified, Prometheus was not able to reach alertmanager entirely as well.

Environment

  • System information:
uname -srm
Linux 4.7.3-coreos-r3 x86_64
  • Prometheus version:
./prometheus --version
prometheus, version 1.4.1 (branch: master, revision: 2a89e8733f240d3cd57a6520b52c36ac4744ce12)
  build user:       root@e685d23d8809
  build date:       20161128-09:59:22
  go version:       go1.7.3
  • Alertmanager version:
    Not relevant, but:
/bin/alertmanager --version
alertmanager, version 0.5.1 (branch: master, revision: fddd88400b7264a6873d886fb9bf9321c631f53a)
  build user:       nev@pc-nev
  build date:       20170110-18:40:49
  go version:       go1.7.3
  • Prometheus configuration file:
    Not relevant, no <alertmanager_config> is configured.
  • Alertmanager configuration file:
    Not relevant.
  • Logs:
time="2017-01-16T12:47:40Z" level=error msg="Error sending alerts: bad response status 401 Unauthorized" alertmanager="https://<static_url>:443/api/v1/alerts" count=1 source="notifier.go:335" 
```
@bwplotka

This comment has been minimized.

Copy link
Contributor Author

bwplotka commented Jan 16, 2017

Created proposition for the fix ^

#2345

@bwplotka

This comment has been minimized.

Copy link
Contributor Author

bwplotka commented Jan 16, 2017

Fix merged.

@bwplotka bwplotka closed this Jan 16, 2017

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.