Prakash
Prakash

Reputation: 2772

Grafana is not able to get Prometheus metrics although Prometheus Datasource is validated successfully

I am trying to configure Grafana to visulaize metrics collected by Prometheus. My Prometheus Datasource is validated successfully. But when I am trying to create dashboard then it's showing error saying "can not read property 'result' of undefined"

I am adding screenshots. Following image shows datasouces validated successfully

Second image shows waht error I am getting

Upvotes: 7

Views: 26680

Answers (2)

Please see the guide below to fix the issue!

This will work as long as you have both your Grafana and Prometheus running as a docker images so before you begin please run the command below to be sure that both prom and Grafana images are up

docker ps 

To connect the prometheus to GRAFANA, you will need to get the prometheus server IP address that is running as a docker image from host.

Use this command on your terminal to display all the container IDs:

docker ps -a 

You will see your prometheus server container ID displayed for example "faca0c893603". Please copy the ID and run the command below on your terminal to see the IP address of your Prometheus server:

docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' faca0c893603 

Note : (faca0c893603 is the ContainerID of the prom/prometheus server)

When you run the command it will display the IP address(172.17.0.3) of the Prometheus container which needs to be mapped with the port of the prometheus server on Grafana.

On data source on Grafana, put this on the URL http://172.17.0.3:9090 and try to save and test.

Upvotes: 3

mactire
mactire

Reputation: 333

It looks like you are pointing towards the node exporter endpoint and not Prometheus Server. The default Prometheus Server endpoint is 9090. Try change your source to http://192.168.33.22:9090

Grafana doesn't query Node Exporter directly, it queries Prometheus Server which gathers the time series statistics.

Upvotes: 16

Related Questions