PHP APM agent cannot connect

Hi All,

I'm getting an error message in /var/log/messages after In installed the php apm-agent

Jul  9 12:39:11 localhost journal: ool www: Elastic APM PHP Tracer [PID: 7439] 2021-07-09 12:39:11.677510+08:00 [ERROR]    [Backend-Comm] [backend_comm.c:169] [sendEventsToApmServer] Sending events to APM Server failed. URL: `http://10.40.3.10:8200/intake/v2/events'. Error message: `Couldn't connect to server'.
Jul  9 12:39:11 localhost journal: ool www: Elastic APM PHP Tracer [PID: 7440] 2021-07-09 12:39:11.817433+08:00 [ERROR]    [Backend-Comm] [backend_comm.c:169] [sendEventsToApmServer] Sending events to APM Server failed. URL: `http://10.40.3.10:8200/intake/v2/events'. Error message: `Couldn't connect to server'.
Jul  9 12:39:11 localhost journal: ool www: Elastic APM PHP Tracer [PID: 7442] 2021-07-09 12:39:11.840635+08:00 [ERROR]    [Backend-Comm] [backend_comm.c:169] [sendEventsToApmServer] Sending events to APM Server failed. URL: `http://10.40.3.10:8200/intake/v2/events'. Error message: `Couldn't connect to server'.
Jul  9 12:39:11 localhost journal: ool www: Elastic APM PHP Tracer [PID: 7441] 2021-07-09 12:39:11.862374+08:00 [ERROR]    [Backend-Comm] [backend_comm.c:169] [sendEventsToApmServer] Sending events to APM Server failed. URL: `http://10.40.3.10:8200/intake/v2/events'. Error message: `Couldn't connect to server'.
Jul  9 12:39:11 localhost journal: ool www: Elastic APM PHP Tracer [PID: 7438] 2021-07-09 12:39:11.867380+08:00 [ERROR]    [Backend-Comm] [backend_comm.c:169] [sendEventsToApmServer] Sending events to APM Server failed. URL: `http://10.40.3.10:8200/intake/v2/events'. Error message: `Couldn't connect to server'.

The configs in the following files:
lrwxrwxrwx. 1 root root 46 Jul 9 12:36 98-elastic-apm.ini -> /opt/elastic/apm-agent-php/etc/elastic-apm.ini
lrwxrwxrwx. 1 root root 53 Jul 9 12:36 99-elastic-apm-custom.ini -> /opt/elastic/apm-agent-php/etc/elastic-apm-custom.ini

[root@localhost php.d]# cat 98-elastic-apm.ini
; ***** DO NOT EDIT THIS FILE *****
; THIS IS AN AUTO-GENERATED FILE by the Elastic PHP agent post-install.sh script
; To overwrite the INI settings for this extension, edit
; the INI file in this directory "/opt/elastic/apm-agent-php/etc/elastic-apm-custom.ini"
[elastic]
extension=/opt/elastic/apm-agent-php/extensions/elastic_apm-20190902.so
elastic_apm.bootstrap_php_part_file=/opt/elastic/apm-agent-php/src/bootstrap_php_part.php
; END OF AUTO-GENERATED by the Elastic PHP agent post-install.sh script

99-elastic-apm-custom.ini

; This file contains the various settings for the Elastic APM PHP agent. For
; further details refers to the following URL:
; https://www.elastic.co/guide/en/apm/agent/php/current/configuration-reference.html
;

[elastic]
elastic_apm.enabled = true
;elastic_apm.api_key = "REPLACE_WITH_API_KEY"
;elastic_apm.environment = "wordpress_test"
elastic_apm.log_level = "INFO"
elastic_apm.log_level_stderr = "INFO"
;elastic_apm.secret_token = "REPLACE_WITH_SECRET_TOKEN"
;elastic_apm.server_timeout = "30s"
elastic_apm.server_url = "http://10.40.3.10:8200"
elastic_apm.service_name = "wordpress_test"
elastic_apm.log_level_syslog=TRACE
;elastic_apm.service_version = "REPLACE_WITH_OUTPUT_FROM_git rev-parse HEAD"
;elastic_apm.transaction_max_spans = 500
;elastic_apm.transaction_sample_rate = 1.0
;elastic_apm.verify_server_cert = true

However curl seems to work from the same server.

curl http://10.40.3.10:8200/intake/v2/events
{
  "accepted": 0,
  "errors": [
    {
      "message": "only POST requests are supported"
    }
  ]
}

Any hints on what I need to check?

My php -i for elastic is as follows:

/etc/php.d/98-elastic-apm.ini,
/etc/php.d/99-elastic-apm-custom.ini
elastic_apm
bootstrap_php_part_file => `/opt/elastic/apm-agent-php/src/bootstrap_php_part.php' => /opt/elastic/apm-agent-php/src/bootstrap_php_part.php => INI file
elastic_apm.abort_on_memory_leak =>
elastic_apm.api_key =>
elastic_apm.assert_level =>
elastic_apm.bootstrap_php_part_file => /opt/elastic/apm-agent-php/src/bootstrap_php_part.php => /opt/elastic/apm-agent-php/src/bootstrap_php_part.php => /opt/elastic/apm-agent-php/src/bootstrap_php_part.php
elastic_apm.breakdown_metrics =>
elastic_apm.enabled => 1 => 1 => 1
elastic_apm.environment =>
elastic_apm.hostname =>
elastic_apm.internal_checks_level =>
elastic_apm.log_file =>
elastic_apm.log_level => INFO => INFO => INFO
elastic_apm.log_level_file =>
elastic_apm.log_level_stderr => INFO => INFO => INFO
elastic_apm.log_level_syslog => TRACE => TRACE => TRACE
elastic_apm.memory_tracking_level =>
elastic_apm.secret_token =>
elastic_apm.server_timeout =>
elastic_apm.server_url => http://10.40.3.10:8200 => http://10.40.3.10:8200 => http://10.40.3.10:8200
elastic_apm.service_name => wordpress_test => wordpress_test => wordpress_test
elastic_apm.service_version =>
elastic_apm.transaction_max_spans =>
elastic_apm.transaction_sample_rate =>
elastic_apm.verify_server_cert =>
elastic_apm.abort_on_memory_leak => no value => no value
elastic_apm.api_key => no value => no value
elastic_apm.assert_level => no value => no value
elastic_apm.bootstrap_php_part_file => /opt/elastic/apm-agent-php/src/bootstrap_php_part.php => /opt/elastic/apm-agent-php/src/bootstrap_php_part.php
elastic_apm.breakdown_metrics => no value => no value
elastic_apm.enabled => 1 => 1
elastic_apm.environment => no value => no value
elastic_apm.hostname => no value => no value
elastic_apm.internal_checks_level => no value => no value
elastic_apm.log_file => no value => no value
elastic_apm.log_level => INFO => INFO
elastic_apm.log_level_file => no value => no value
elastic_apm.log_level_stderr => INFO => INFO
elastic_apm.log_level_syslog => TRACE => TRACE
elastic_apm.memory_tracking_level => no value => no value
elastic_apm.secret_token => no value => no value
elastic_apm.server_timeout => no value => no value
elastic_apm.server_url => http://10.40.3.10:8200 => http://10.40.3.10:8200
elastic_apm.service_name => wordpress_test => wordpress_test
elastic_apm.service_version => no value => no value
elastic_apm.transaction_max_spans => no value => no value
elastic_apm.transaction_sample_rate => no value => no value
elastic_apm.verify_server_cert => no value => no value

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