Closed suntereo closed 1 year ago
As of 4.1
Graylog has a built-in Prometheus exporter that should be used instead of the archived project you mentioned. This isn't anything specific to the Docker image.
Try adding these environment variables:
GRAYLOG_PROMETHEUS_EXPORTER_ENABLED=true
GRAYLOG_PROMETHEUS_EXPORTER_BIND_ADDRESS=0.0.0.0:9833
... and then add port 9833:9833/tcp
and ~restart~ rebuild. After that you should be able to hit http://$SOME_HOST_IP:9833/
and see metrics.
Thank you Greg! I can confirm your steps do work on my end.
But I'm still confused. The graylog.conf file shows 127.0.0.1:
# IP address and port for the Prometheus exporter HTTP server.
# Default: 127.0.0.1:9833
#prometheus_exporter_bind_address = 127.0.0.1:9833
Because of this, 127.0.0.1 is what I was trying to use. But this fails on my end with:
Your advice to use 0.0.0.0 does resolve this error.
But if you use 127.0.0.1:9833, does it work on your end? If not, shouldn't graylog.conf be updated to show 0.0.0.0?
The difference is that you're running Graylog within a Docker container rather than directly on the host system. By default, 127.0.0.1
in your container is local to the container (i.e. it's not the 127.0.0.1
of your host system). 0.0.0.0
binds to all available interfaces in the container, including the one used when exposing ports. Docker's networking documentation covers all of this in detail.
127.0.0.1:9833
is a reasonable default, as it prevents unintentionally exposing metrics.
Thanks again. That is very helpful.
I bet others will blindly follow the comments in the graylog.conf and have it fail like I did. But I suppose they can just find this thread and get the solution they need.
The grayling.conf file for this repo seems to suggest that Prometheus is automatically included. However, Prometheus is not automatically installed in the Docker version. You can see this by comparing the Docker version with the non-Docker version.
This led to hours of confusion on my end. Poor me, I know. I would like to document what I did to get Prometheus working inside the Docker build. And maybe somebody can remove the Prometheus settings from the grayling.conf file. Or better, bring Prometheus into this build as well.
Here's how I installed the Prometheus Exporter for the Docker version
Hopefully that will help some struggling soul who is pulling their hair out over this!