Help with configuring APM elastic agent

hello,

I'm setting up APM for my single node ELK stack and unfamiliar with JAVA parameters . The apm-server has been set up correctly .

The instructions to set up were being followed from Kibana's APM tutorial . what am i doing wrong. ?

root@dev-elk-app01:~#  java -javaagent:/home/sn/elastic-apm-agent-1.26.0.jar      -Delastic.apm.service_name=apm-server      -Delastic.apm.server_urls=http://172.26.207.164:8200      -Delastic.apm.secret_token=      -Delastic.apm.application_packages=org.example      -jar apm-server.jar
Error: Unable to access jarfile apm-server.jar

APM version: 7.15
Kibana/Elasticsearch/Logstash version : 7.15

Have you tried putting both the java agent and jar file in the same directory oy using absolute paths ? Also file permissions?

These are the permissions

root@dev-elk-app01:/home/sn# ls -l elastic-apm-agent-1.26.0.jar 
-rwxr-xr-- 1 sn users 9320601 Sep 23 07:45 elastic-apm-agent-1.26.0.jar
root@dev-elk-app01:/home/sn# 

Also what did you mean by placing both java agent and jar file in the same directory ? i thought javaagent was an argument to java

Following the opbeans example, this worked for me. The problem with yours looks like accessing what comes after

-jar

Seems to be where the issue is

java -javaagent:elastic-apm-agent-1.26.0.jar -Delastic.apm.service_name=opbeans-java -Delastic.apm.server_urls=https://my-apm.server.com -
Delastic.apm.environment=Development -Delastic.apm.application_packages=co.elastic.apm.opbeans -jar /home/pi/opbeans-java/opbeans/target/opbeans-0.0.1-SNAPSHOT.jar```
1 Like

okay , that seemed to have worked

root@dev-elk-app01:~# java -javaagent:/home/sn/elastic-apm-agent-1.26.0.jar -Delastic.apm.service_name=apm-server -Delastic.apm.server_urls=http://172.26.207.164:8200 -Delastic.apm.secret_token= -Delastic.apm.application_packages=org.example -jar /home/sn/elastic-apm-agent-1.26.0.jar 
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-09-23 11:35:11,461 [main] INFO  co.elastic.apm.agent.util.JmxUtils - Found JVM-specific OperatingSystemMXBean interface: com.sun.management.OperatingSystemMXBean
2021-09-23 11:35:11,514 [main] INFO  co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.26.0 as apm-server on Java 11.0.11 Runtime version: 11.0.11+9-Ubuntu-0ubuntu2.18.04 VM version: 11.0.11+9-Ubuntu-0ubuntu2.18.04 (Ubuntu) Linux 4.15.0-154-generic
2021-09-23 11:35:11,514 [main] INFO  co.elastic.apm.agent.configuration.StartupInfo - service_name: 'apm-server' (source: Java System Properties)
2021-09-23 11:35:11,514 [main] INFO  co.elastic.apm.agent.configuration.StartupInfo - secret_token: 'XXXX' (source: Java System Properties)
2021-09-23 11:35:11,515 [main] INFO  co.elastic.apm.agent.configuration.StartupInfo - server_urls: 'http://172.26.207.164:8200' (source: Java System Properties)
2021-09-23 11:35:11,515 [main] INFO  co.elastic.apm.agent.configuration.StartupInfo - application_packages: 'org.example' (source: Java System Properties)
2021-09-23 11:35:12,951 [main] INFO  co.elastic.apm.agent.impl.ElasticApmTracer - Tracer switched to RUNNING state
2021-09-23 11:35:12,953 [elastic-apm-server-healthcheck] INFO  co.elastic.apm.agent.report.ApmServerHealthChecker - Elastic APM server is available: {  "build_date": "2021-09-16T02:05:39Z",  "build_sha": "a183f675ecd03fca4a897cbe85fda3511bc3ca43",  "version": "7.15.0"}
no main manifest attribute, in /home/sn/elastic-apm-agent-1.26.0.jar
root@dev-elk-app01:~# 

any suggestions on how i could fix this

Shouldn't you be pointing to your application and not the apm agent?

-jar apm-server.jar

i did try it , had the same error after specifying the absolute path .

root@dev-elk-app01:~# java -javaagent:/home/sn/elastic-apm-agent-1.26.0.jar -Delastic.apm.service_name=apm-server      -Delastic.apm.server_urls=http://172.26.207.164:8200      -Delastic.apm.secret_token=      -Delastic.apm.application_packages=org.example      -jar /home/sn/apm-server.jar
Error: Unable to access jarfile /home/sn/apm-server.jar

Your syntax is connect and you did get previously a response to saying you Elastic APM server was up and running. Could it be the application itself? Maybe try running a control test by following the opbeans tutorial ?

i was looking at the logs, and looks it is running . seems
like the index is mising

Sep 23 12:37:06 dev-elk-app01 apm-server[23831]: {"log.level":"error","@timestamp":"2021-09-23T12:37:06.247Z","log.logger":"publisher_pipeline_output","log.origin":{"file.name":"pipeline/output.go","file.line":154},"message":"Failed to connect to backoff(elasticsearch(http://172.26.207.164:9200/app/ELK-Logs/apm-server)): 404 Not Found: {\"error\":{\"root_cause\":[{\"type\":\"index_not_found_exception\",\"reason\":\"no such index [app]\",\"resource.type\":\"index_expression\",\"resource.id\":\"app\",\"index_uuid\":\"_na_\",\"index\":\"app\"}],\"type\":\"index_not_found_exception\",\"reason\":\"no such index [app]\",\"resource.type\":\"index_expression\",\"resource.id\":\"app\",\"index_uuid\":\"_na_\",\"index\":\"app\"},\"status\":404}","service.name":"apm-server","ecs.version":"1.6.0"}

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