I have a single, locally run, docker instance with containers for Grafana(v8.4.0-43439pre) and Prometheus(2.32.1), when I try to add Prometheus as a datasource to Grafana the WebUI gives me the following error: Error reading Prometheus: Metric request error and the Grafana logs gives me the following error: first path segment in URL cannot contain colon
When adding the datasource I use serverip:3200 as the URL.
Both are clean containers, no other configurations made.
Grafana:
docker run -d -p 3000:3000 --name grafana grafana/grafana:main
Prometheus:
docker run -d -p 3200:3200 --name prometheus prom/prometheus:latest
I've searched for this issue, but couldn't find an issue or solutions that's quite the same as mine.
This is my first time working with any of these applications, hope someone can help me out.
CodePudding user response:
The follwoing error can be fixed by including http://
in the URL for the datasource:
error: first path segment in URL cannot contain colon
Prometheus listens on port 9090 by default, so you can either run the container using that port:
docker run -d -p 9090:9090 --name prometheus prom/prometheus:latest
Or if you want to use another port you should map that to 9090:
docker run -d -p 3200:9090 --name prometheus prom/prometheus:latest
CodePudding user response:
Had to run the container with -p 3200:9090 instead of -p 3200:3200 to assign the right port.