1

I wrote a function for creating charts in Kibana.

Firstly, I installed Kibana and Elasticsearch on my local PC. I am sending a request for creating data and charts and taking the embedded iframe code from there.

In this scenario everything is okay. I could create charts clearly and my functions are working great. I could show charts on my page.

Then I installed my project, kibana and elastic search on a server. And I get this error inside of the iframe tag:

2**...**6 refused to connect.

What can be the problem?

part of my functions

elasticsearch_address= 'http://localhost:9200'
self.es = Elasticsearch([elasticsearch_address], use_ssl=False,
                                verify_certs=False, ssl_show_warn=False, send_get_body_as='POST', )

It works fine. I can get and post requests to this address. So, I think the problem is in Kibana.

part of my functions

 url3 = "http://localhost:5601/api/saved_obj..."
 headers3 = {"Accept-Language": "tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3",
                                "Accept-Encoding": "gzip, deflate",
                                "Referer": 
                                "http://localhost:5601/app/management/kibana/objects",
                                "Content-Type": "multipart/form-data; boundary=-..."
                                "Origin": "http://localhost:5601", "kbn-xsrf": "true", "Sec- 
                                     Fetch-Dest": "empty",
                                "Sec-Fetch-Mode": "cors", "Sec-Fetch-Site": "same-origin"}
data3 = "--...."
r3 = requests.post(url3, headers=headers3, data=data3)

destinationid = re.findall(r"\"destinationId\":\"(.*?)\"", r3.text)
destinationid = destinationid[-1]
request_text = "http://localhost:5601/app/dashboards#..."
user = request.user
user.iframe = request_text.replace("localhost", "2**.***.***.**")
user.save()

in the part of user.iframe, I get the iframe code. I change it with the server's IP number to can reach from browser.

Where is my mistake? Is there any setting for this in Kibana?

0

1 Answer 1

4

You need to check if Kibana and elastic search are binded to the correct ip and port

in your server , check if your kibana.yml

 server.port: 5601
 server.host: 2**.***.***.****
 server.name: "kibanaserver" 
 elasticsearch.url: "***.***.***.****:9200" 
 kibana.index: ".tkibana" 
 logging.dest: /var/log/kibana/kibana.log

Similar stuff , you need to do in your elasticsearch.yml also

And then try connecting

curl -XGET "***.***.***.***:5601" 
curl -XGET "***.***.***.***:9200" 

you shouldn't get a connection refused here

You can also check from your server , if the ports are listening

netstat -a -n | grep tcp | grep 9200
netstat -a -n | grep tcp | grep 5601
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.