How to configure Java agent with Apache tomcat

(Aftab Ali) #1

Dear Team,

I just install apm-server in ubuntu 16.04 and pointed es ip and I have configured java agent with tomcat bin files like

vim /opt/tomcat/bin/

export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=4096m"
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/home/aftab/Downloads/elastic-apm-agent-0.7.0.jar

Tomcat service status is Active

But I am not getting proper details of tomcat screenshot attached please check and help me how to solve that type of issue, I am using javaagent beta version

I am getting one error tomcat which is given below:-

The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:

A 2nd error I am getting with APM-server log which is given below:-

beater/beater.go:136 failed to listen:listen tcp bind: address already in use

What, i need to do ?

(Felix Barnsteiner) #2

Hi and thanks for testing the Java agent.

Could you send me the full agent logs?


(Felix Barnsteiner) #3

Maybe you have already started the APM Server or there is already a different process listening on the port 8200

(Aftab Ali) #4

Thanks for the reply.

After getting an error with APM-server "listen TCP bind: address already in us"I am getting dashboard in APM and I am to view and see status but I am not able to see JVM memory usage and Threads status, please look into the matter.

APM-Server logs given below:--

2018-09-20T13:18:51.018+0530 INFO [request] beater/handlers.go:282 handled request {"request_id": "05b0fc4c-c76a-486b-a31d-b1bef828c065", "method": "POST", "URL": "/v1/transactions", "content_length": -1, "remote_address": "", "user-agent": "co/elastic/apm/shaded/okhttp/3.9.1", "response_code": 202}
2018-09-20T13:18:51.024+0530 INFO [request] beater/handlers.go:282 handled request {"request_id": "3e2e88a3-6441-4766-ac16-7160179609f7", "method": "POST", "URL": "/v1/transactions", "content_length": -1, "remote_address": "", "user-agent": "co/elastic/apm/shaded/okhttp/3.9.1", "response_code": 202}
2018-09-20T13:18:51.313+0530 INFO [request] beater/handlers.go:282 handled request {"request_id": "f88b816e-bb90-42fb-8fe1-bddf3d7c01dd", "method": "POST", "URL": "/v1/transactions", "content_length": -1, "remote_address": "", "user-agent": "co/elastic/apm/shaded/okhttp/3.9.1", "response_code": 202}

(Aftab Ali) #5

Now Apm-server is not giving me any error.

(Aftab Ali) #6

Please share the way, how to see status of given parameters :--

  • memory usage – this reading is critical, since running low on heap memory will cause your application to perform slower, and can even lead to OutOfMemory exceptions; on the other hand, using very little of the available memory could mean you could decrease your memory needs and therefore minimize costs
  • garbage collection – since this is a resource-intensive process itself, you have to determine the right frequency at which it should be run, as well as if a sufficient amount of memory is freed up every time
  • thread usage – if there are too many active threads at the same time, this can slow down the application, and even the whole server
  • request throughout – this metric refers to the number of requests that the server can handle for a certain unit of time and can help determine your hardware needs
  • number of sessions – a similar measure to the number of requests is the number of sessions that the server can support at a time
  • response time – if your system takes too long to respond to requests, users are likely to quit so it’s crucial to monitor this response time and investigate the potential causes
  • database connection pool – monitoring this can help tune the number of connections in a pool that your application needs
  • error rates – this metric is helpful in identifying any issues in your codebase
  • uptime – this is a simple measure that shows how long your server has been running or down

(Felix Barnsteiner) #7

The agent currently does not send metrics, like memory usage, GC etc.

For this I'd recommend having a look at the Jolokia beat:

The Java agent is useful for tracing, which basically means it records the incoming requests so you can later analyze what was slow during a particular request or why it failed. It also Provides throughput, response time and error rate metrics. You can see those in your latest screenshot.

In the future, we will work on providing certain JVM level metrics as well. So your input in which metrics are interesting to you are very much appreciated!


(Aftab Ali) #8

Thanks for the reply felix, elastic is working on it JVM metrics with APM agent?

(Felix Barnsteiner) #9

We are not currently working on that but we have plans to support metrics in the future.

(Aftab Ali) #10


(system) #11

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