1

I am trying out Elastic APM.

I used automatic setup with apm-agent-attach-standalone.jar. (I also used -javaagent flag (manual setup), and it worked fine)

C:\Users\dsm\Documents>java -jar apm-agent-attach-1.9.0-standalone.jar --pid 16832 --args 'service_name=test;server_urls=http://localhost:8200'
--args is deprecated in favor of --config
2019-09-04 15:05:01.353  INFO Attaching the Elastic APM agent to 16832
2019-09-04 15:05:04.619  INFO Done

Data was successfully recieved from the agents, and I used APM UI to monitor.

How do I detach this agent from the process?

What do I do if I want to stop this agent?

Jin Lee
  • 3,194
  • 12
  • 46
  • 86

1 Answers1

1

You can start your application with argument active=false.

C:\Users\dsm\Documents>java -jar apm-agent-attach-1.9.0-standalone.jar --pid 16832 --args 'service_name=test;server_urls=http://localhost:8200;active=false'

trisek
  • 701
  • 6
  • 14
  • I tried your commands above with CMD and PowerShell. But the process is still running when I check with --list. – Jin Lee Dec 11 '19 at 09:22
  • `java -jar apm-agent-attach-1.12.0-standalone.jar --pid 18144 --args 'service_name=test;server_urls=http://localhost:8200;active=false'` – Jin Lee Dec 11 '19 at 09:23
  • `java -jar apm-agent-attach-1.12.0-standalone.jar --list` – Jin Lee Dec 11 '19 at 09:24
  • I still get data from the agent, and I can see that from APM UI in Kibana. I don't think 'active=false' works. (Even though the documentation says it will) https://www.elastic.co/guide/en/apm/agent/java/current/config-core.html#config-active – Jin Lee Dec 12 '19 at 01:25
  • Ok, can you then try to run agent with config flag. E.g like this: `java -jar apm-agent-attach-1.12.0-standalone.jar --pid 18144 --config service_name=test server_urls=http://localhost:8200 active=false` – trisek Dec 17 '19 at 09:25
  • What exactly you see in Kibana, only metrics data, or traces too? – trisek Dec 18 '19 at 06:36
  • I'm gonna have to look at that later. My app is a very simple springboot app. According to my memory, I saw metrics data and also request and many other graphs, and one method (the app had one method). But I just want to see apm-agent gone when I do `--list` . When I manually kill the agent process (kill), I don't see any APM services in Kibana APM UI(of course), but when I do the commands above, I still see services in KIbana APM UI. service = test ( which I create with above commands) – Jin Lee Dec 18 '19 at 07:28
  • You can read [here](https://discuss.elastic.co/t/unable-to-disable-apm-via-environment-variable/180558/3) more about how the agent is working. – trisek Dec 18 '19 at 07:39