Getting 403 forbidden error when adding data source by IP

Whenever I try to add a Prometheus data source by it’s domain name (eg: http://abc.com:9090), the data source gets loaded just fine. However it throws error when I try to add Prometheus data source by it’s ip (eg: http://934.35.32.1:9090 and 934.35.32.1:9090).

The error messages can be seen in the attached images.


Grafana version v9.2.5

Hi @gauravpudel1990,

Please check the following documentation for to how to add Prometheus Datasource into Grafana.

Also, what happens in the browser once you type http://934.35.32.1:9090/metrics ?

Are all network ports and firewall allowed to send and receive on this port?

Lastly, if this all does not help, then we will need the grafana logs to check it further (default location is /var/log/grafana/grafana.log)

On the browser, it gives the metrics data just fine for both the domain name ( http://abc.com:9090/metrics) and the IP ( http://934.35.32.1:9090/metrics), they point to the same machine. Using the domain name works fine but not same case with the IP.

I even tried with adding 3 other machines using their IP (they don’t have domain assigned to them) which run prometheus with node-exporter and all seem to give the same error message while adding.

All these machines have port 9090 allowed to be accessed from any IP/domain.

Hi @gauravpudel1990,

I am not sure why as it seems to be working fine in my test VM.

I suggest that you check the grafana logs as it might contains more information as what is causing this issue.

The default location of logs is at /var/log/grafana/grafana.log