Error reading Prometheus dial tcp: lookup Prometheus: no such host

while adding datasouce getting below mentioned error, please do need full.

Error reading Prometheus: Post “http://Prometheus:9090/api/v1/query”: dial tcp: lookup Prometheus: no such host

“Prometheus: no such host”.

Thay’s a pretty clear error message, I think.

You have no machine which your Grafana server can find by the name of
“Prometheus”.

That means it isn’t on your local DNS server, and it isn’t in the Grafana
machine’s /etc/hosts file.

Trying using its IP address instead?

Antony.

thank you for responses. After adding server details getting different error

Error reading Prometheus: Post “http://10.128.0.7:9090/api/v1/query”: dial tcp 10.128.0.7:9090: i/o timeout

You have to give http://localhost:9090 in URL and test it. It will Work.

Sorry to resurrect a dead thread but this resolved the issue for me so leaving it here in case others find it useful.

If you’re following the grafana fundatmentals tutorial, http://prometheus:9090 should work as the url for you datasource. Run docker ps to check if tutorial-environment_prometheus_1 is running.

For me it was not and running docker-compose down and then docker-compose up -d resolved the error so I could explore the datasource in grafana.

After following the tutorial and getting the same error, changing Connections → Data sources to http://localhost:9090 worked!! Thank you!