discourse / prometheus_exporter

A framework for collecting and aggregating prometheus metrics
MIT License
525 stars 153 forks source link

Allow binding server to both ipv4/ipv6 interfaces #260

Closed sosedoff closed 1 year ago

sosedoff commented 1 year ago

Starting prometheus_exporter -v -b ALL -p 8080 will include the log message:

2022-12-26 16:54:44 -0600 Starting prometheus exporter on ALL:8080
[2022-12-26 16:54:44] INFO  Listening on both 0.0.0.0/:: network interfaces
[2022-12-26 16:54:44] INFO  WEBrick 1.7.0
[2022-12-26 16:54:44] INFO  ruby 2.7.2 (2020-10-01) [arm64-darwin21]
[2022-12-26 16:54:44] INFO  WEBrick::HTTPServer#start: pid=86361 port=8080

netstat:

$ netstat -an -ptcp | grep LISTEN | grep 8080
tcp4       0      0  *.8080                 *.*                    LISTEN
tcp6       0      0  *.8080                 *.*                    LISTEN
SamSaffron commented 1 year ago

I think @xfalcox noticed a similar issue, in the original versions we supported a bind all and then it was no longer there.

I am happy with this change, but can we update the documentation as well?

sosedoff commented 1 year ago

Yep, i will update the docs

xfalcox commented 1 year ago

Yes, had the same problem when updating from .5 to the latest version of this gem in Discourse.

Over there I fixed this problem by passing * as the bind address, which in glibc means that we will bind to both IPv4 and IPv6. However that doesn't work if someone is using musl. So 👍 for this approach from me.

sosedoff commented 1 year ago

Should be ready to go!

gphat commented 1 year ago

[arrives late] Hey friends, any plans to release an updated version with this included? I was confused as to why it wasn't working only to release it's not in the 2.0.6 version that is most recent at this time. 😸

SamSaffron commented 1 year ago

will try to post a new version tomorrow!

On Thu, Jan 12, 2023 at 4:20 AM Cory G Watson @.***> wrote:

arrives late Hey friends, any plans to release an updated version with this included? I was confused as to why it wasn't working only to release it's not in the 2.0.6 version that is most recent at this time. 😸

— Reply to this email directly, view it on GitHub https://github.com/discourse/prometheus_exporter/pull/260#issuecomment-1379218995, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABIXNCV5LOXQBXT2JMYFTWR3TUXANCNFSM6AAAAAATJ6GVHM . You are receiving this because you modified the open/close state.Message ID: @.***>

gphat commented 1 year ago

Appreciated! I just set to pull from head, but lost some time to being confused why the -b ANY wasn't working for me, only to realize it wasn't released yet. 😆