Elasticsearch APM agent not pushing to server

I have a server running on a remote computer and have installed the APM agent on another computer with Flask installed. But for some reason I keep getting this error on the client:

Connection to APM Server timed out (url:http://134.446.25.12:8200'/v1/transactions, timeout: None seconds)
Failed to submit message: ''

Here is the sample flask code that I'm trying to run:

from flask import Flask
from elasticapm.contrib.flask import ElasticAPM
from flask import abort

app = Flask(name)
app.config['ELASTIC_APM'] = {
'APP_NAME': 'mytestamp',
'SERVICE_NAME': 'myapp',
'SERVER_URL': 'http://134.446.25.12:8200'
}
apm = ElasticAPM(app)

@app.route('/ok', methods=['GET', 'POST'])
def ok():
apm.capture_message('ok message')
return 'ok'

The server has no security in place that is stopping the connection so not sure what else to do.

Any help is appreciated.

Helen

Hi Helen

one possible cause is that the apm-server on your other machine isn't bound to listen to external connections. By default, the apm-server only binds to localhost. You can change that by using the -E apm-server.host option:

./apm-server -e -E apm-server.host=0.0.0.0:8200

Note however that this will expose your apm-server to any other machine that can reach that IP address, so we suggest to use https and a secret token to secure your apm-server. See https://www.elastic.co/guide/en/apm/server/current/security.html for more information.

@beniwohli Thanks, you are correct. Changing the connection to listen to external connections did the trick.

Nice one :slight_smile:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.