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

Kevin Simper
1 min readOct 23, 2018

--

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

--

--

Kevin Simper
Kevin Simper

Written by Kevin Simper

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

Responses (1)