How to fix: “is not a valid hostname prometheus”

If you are getting “is not a valid hostname prometheus” when trying to setup Prometheus, then you likely added a full URI, but Prometheus only accepts a hostname, so if you want to add a URL you need to add the hostname and then change “metrics_path”.

🚫 mykevinwebsite.com/mycustompath

✅ mykevinwebsite.com

By default “metrics_path” is “/metrics”, so if it is that, then you don’t need to define it, otherwise it looks like this:

static_configs:
— targets: [‘mykevinwebsite.com’]
metrics_path: "/mycustompath"

The reason is to keep your config more simple and have fewer errors so that every host can have a different path.

I also wrote an article about how to use Prometheus with Kubernetes, read it here!

https://www.kevinsimper.dk/posts/kubernetes-prometheus-docker-for-mac

Written by

I really like building stuff with React.js and Docker and also Meetups ❤

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store