Bad gateway Http error- Prometheus s as Datasource

Hello I have deployed grafana on openshift, and Prometheus on a xaas server for monitoring Cassandra. I am able to c metrics on my own browser with http://localhost:7070 but while adding datasource in grafana I am getting error as Bad gateway.
in url im giving ip of my server where Prometheus is installed and working.
Access: Server.

Please help in getting data in dashboards n in getting Prometheus added as my datasource.

You need to make sure that Grafana server (backend) can communicate with your prometheus server when you’re using Access: Server. So a curl from grafana server should be able to reach your prometheus server for example.

yeah I used curl command from my openshift grafana pod terminal and I am able to see metrics

I’m not sure what that means. Is that the same as you would have ssh:ed into grafana pod and run curl ...?

curl http://:7070/metrics

curl http://[IP-Prometheus-Server]:7070/metrics

yes u r correct. I am using the grafana pod terminal

Hi, I have a similar problem. I am using Amazon Linux on some EC2 instances. I’m using one instance and trying to get Grafana to display Prometheus metrics from another instance. I tried to follow the instructions given at this link:
https://prometheus.io/docs/visualization/grafana/
But when I try to create the data source I get “HTTP Error Bad Gateway”. I tried localhost:9090 as well as ec2-13-59-121-49.us-east-2.compute.amazonaws.com:9090 but I got the same error for both of those. Any suggestions would be appreciated.

[ec2-user@ip-172-31-31-74 ~] curl http://[ip of other instance]:7070/metrics curl: (7) Failed to connect to ec2-13-59-121-49.us-east-2.compute.amazonaws.com port 7070: Connection timed out [ec2-user@ip-172-31-31-74 ~] curl [http://]localhost:7070/metrics
curl: (7) Failed to connect to localhost port 7070: Connection refused

I also tried 9090 with the same result.

Hi, Please refer to the following git to setup Prometheus and Grafana on EC2 instances: