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

Listening on wrong addresses #4036

Closed
lgierth opened this Issue Apr 2, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@lgierth
Copy link

lgierth commented Apr 2, 2018

What did you do?
Start prometheus with --web.listen-address=127.0.0.1:9090

> ps aux | grep prom
prometh+ 27719  339  1.0 5369168 700096 ?      Ssl  06:22   0:47 /usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --web.console.libraries=/etc/prometheus/console_libraries --web.console.templates=/etc/prometheus/consoles   --web.listen-address=127.0.0.1:9090

What did you expect to see?
Expected to see it listen on IPv4 localhost. I also semi-expected it to generally listen on localhost only by default.

What did you see instead? Under which circumstances?
It listens on IPv6 all-hosts (::), and prints IPv4 all-hosts.

> netstat -nlp | grep 9090
tcp6       0      0 :::9090                 :::*                    LISTEN      26163/prometheus
> journalctl -xe | grep prom | grep -i listening
Apr 02 05:55:47 myhost.net prometheus[26163]: level=info ts=2018-04-02T03:55:47.963398278Z caller=web.go:382 component=web msg="Start listening for connections" address=0.0.0.0:9090

With --web.listen-address=localhost:9090 and --web.listen-address=[::1]:9090 it also reports listening on 0.0.0.0, and listens on the same IPv6 all-hosts (instead of localhost), but only responds with 503 (I think the 503 might be unrelated).

Environment

  • System information:

    Linux 4.13.0-36-generic x86_64

  • Prometheus version:

prometheus, version 2.2.1 (branch: master, revision: bc6058c81272a8d938c05e75607371284236aadc)
  build user:       root@myhost.net
  build date:       20180326-06:31:27
  go version:       go1.10
  • Alertmanager version:

    n/a

  • Prometheus configuration file:

---
global:
  scrape_interval:     15s
  scrape_timeout:      10s
  evaluation_interval: 60s

  • Alertmanager configuration file:
n/a
  • Logs:
Apr 02 05:55:47 myhost.net prometheus[26163]: level=info ts=2018-04-02T03:55:47.963398278Z caller=web.go:382 component=web msg="Start listening for connections" address=0.0.0.0:9090
@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Apr 2, 2018

This is a Linux internal thing, nothing to do with Prometheus.

It makes more sense to ask questions like this on the prometheus-users mailing list rather than in a GitHub issue. On the mailing list, more people are available to potentially respond to your question, and the whole community can benefit from the answers provided.

@lgierth

This comment has been minimized.

Copy link
Author

lgierth commented Apr 2, 2018

For the record, I moved --web.listen-address to the front and it now correctly binds to localhost only, i.e.

> /usr/bin/prometheus --web.listen-address=127.0.0.1:9090 --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --web.console.libraries=/etc/prometheus/console_libraries --web.console.templates=/etc/prometheus/consoles   --web.route-prefix=/prometheus

instead of

> /usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --web.console.libraries=/etc/prometheus/console_libraries --web.console.templates=/etc/prometheus/consoles   --web.listen-address=127.0.0.1:9090
@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Apr 3, 2018

That shouldn't make the slightest difference.

@lgierth

This comment has been minimized.

Copy link
Author

lgierth commented Apr 3, 2018

Yes, actually it turned out it was an orphaned doublequote somewhere in the systemd unit file, which apparantly made the arguments look correct, but actually get cut off.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 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 22, 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.