Cannot access data source of elasticsearch using grafana cloud

Viewed 3402

I'm using grafana cloud for creating visualization but when i'm trying to load the data source with elasticsearch i'm getting 502 error. 502 Error

2 Answers

502 usually means bad gateway (there is no connection) and that IP address looks like an internal IP address. GrafanaCloud is a cloud service so it does not have access to internal IP addresses.

Your options are:

  1. Install Grafana locally if you do not want to open up anything over the internet.
  2. Use direct mode instead of proxy mode. This means that requests will go directly from your browser to the elasticsearch server and not go through the Grafana backend server. However, GrafanaCloud is on https so you will get a mixed content warning and you would need to solve that by having a proxy in front of your elasticsearch server (or by setting up https for your server).
  3. Make your server accessible over the internet. Setup a static IP address for your elasticsearch server, setup firewall rules etc. so that GrafanaCloud can query your server.

Add the following configurations in config/elasticsearch.yml:

transport.host: localhost 
transport.tcp.port: 9300 
http.port: 9200
network.host: 0.0.0.0
Related