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

Adds healthcheck for checking the status of the container #182

Merged
merged 2 commits into from
Mar 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com
COPY statsd_exporter /bin/statsd_exporter

EXPOSE 9102 9125 9125/udp
HEALTHCHECK CMD curl --fail http://localhost:9102/metrics || exit 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately curl is not available in the image, maybe this works?

Suggested change
HEALTHCHECK CMD curl --fail http://localhost:9102/metrics || exit 1
HEALTHCHECK CMD wget --spider http://localhost:9102/metrics || exit 1

(this is busybox wget)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work, as it only checks the availability of the page, and statsd redirect it back to the default page. Will check and update the best possible way for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you find a way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the timeout to the command, this actually works. Not sure how to reproduce the issue but, i faced the same today and this worked.

vaibhav ~ $ sudo docker ps
CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS              PORTS               NAMES
1baa9f5abb44        prom/statsd-exporter:v0.6.0   "/bin/statsd_exporte…"   5 hours ago         Up 5 hours                              statsd-exporter
vaibhav ~ $ sudo docker exec -it 1baa9f5abb44 sh
/ # wget --spider -S "http://localhost:9102/metrics" -T 60 2>&1
Connecting to localhost:9102 (127.0.0.1:9102)
  HTTP/1.1 500 Internal Server Error
wget: server returned error: HTTP/1.1 500 Internal Server Error

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well i still am not able to find why this is happening, can you suggest some way to debug the root cause as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically, this means that we are trying to serve an invalid combination of metrics. Please check existing issues, and if there isn't one that matches, open a new issue with

  • your mapping configuration
  • a sample of inputs that reproduces the issue (debug logging may help see what happens just before it starts failing)
  • the full output of the /metrics endpoint when it is failing – this usually gives a clue as to what is invalid

ENTRYPOINT [ "/bin/statsd_exporter" ]