Monitoring Tomcat

This article will help you get the Tomcat plugin for sd-agent configured and returning metrics

Installing the tomcat plugin package

Install the tomcat plugin on Debian/Ubuntu:

sudo apt-get install sd-agent-tomcat

Install the tomcat plugin on RHEL/CentOS:

sudo yum install sd-agent-tomcat

Read more about agent plugins.

Configuring the agent to monitor Tomcat

The Tomcat check makes use of JMX so JMX Remote is required on your Tomcat servers. You can find out how to enable this in the Tomcat Documentation.

1. Configure /etc/sd-agent/conf.d/tomcat.yaml

instances:
  - host: localhost
    port: 9012
  #   user: username
  #   password: password
  #   process_name_regex: .*process_name.* # Instead of specifying a host, and port. The agent can connect using the attach api.
  #                                                                       #   This requires the JDK to be installed and the path to tools.jar to be set below.
  #   tools_jar_path: /usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar # To be set when process_name_regex is set
  #   name: tomcat_instance
  #   # java_bin_path: /path/to/java # Optional, should be set if the agent cannot find your java executable
  #   # java_options: "-Xmx200m -Xms50m" # Optional, Java JVM options
  #   # trust_store_path: /path/to/trustStore.jks # Optional, should be set if ssl is enabled
  #   # trust_store_password: password
  #   tags:
  #     env: stage
  #     newTag: test

Ensure that the options for your Tomcat server are correct in your yaml file. It's possible to use a process_name_regex instead of a host and port.

2. Restart the agent

sudo /etc/init.d/sd-agent restart

or

sudo systemctl restart sd-agent

Verifying the configuration
Execute info to verify the configuration with the following:

sudo /etc/init.d/sd-agent info 

or

/usr/share/python/sd-agent/agent.py info

If the agent has been configured correctly you'll see an output such as:

tomcat
-----
  - instance #0 [OK]
  - Collected * metrics

You can also view the metrics returned with the following command:

service sd-agent jmx collect

Configuring graphs

Click the name of your server from the Devices list in your Server Density account then go to the Metrics tab. Click the + Graph button on the right then choose the tomcat metrics to display the graphs. The metrics will also be available to select when building dashboard graphs.

Screen_Shot_2018-01-18_at_11.46.12.png

Monitored metrics

MetricValues
tomcat.bytes_rcvd

Bytes per second received by all request processors.
byte / second
Type: float
tomcat.bytes_sent

Bytes per second sent by all the request processors.
byte / second
Type: float
tomcat.cache.access_count

The number of accesses to the cache per second.
get / second
Type: float
tomcat.cache.hits_count

The number of cache hits per second.
hit / second
Type: float
tomcat.error_count

The number of errors per second on all request processors.
error / second
Type: float
tomcat.jsp.count

The number of JSPs per second that have been loaded in the web module.
page / second
Type: float
tomcat.jsp.reload_count

The number of JSPs per second that have been reloaded in the web module.
page / second
Type: float
tomcat.max_time

The longest request processing time (in milliseconds).
millisecond / None
Type: float
tomcat.processing_time

The sum of request processing times across all requests handled by the request processors (in milliseconds) per second.
None / None
Type: float
tomcat.request_count

The number of requests per second across all request processors.
request / second
Type: float
tomcat.servlet.error_count

The number of erroneous requests received by the servlet per second.
error / second
Type: float
tomcat.servlet.processing_time

The sum of request processing times across all requests to the servlet (in milliseconds) per second.
None / None
Type: float
tomcat.servlet.request_count

The number of requests received by the servlet per second.
request / second
Type: float
tomcat.threads.busy

The number of threads that are in use.
thread / None
Type: float
tomcat.threads.count

The number of threads managed by the thread pool.
thread / None
Type: float
tomcat.threads.max

The maximum number of allowed worker threads.
thread / None
Type: float
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Monday  —  Friday.

10am  —  6pm UK.

Dedicated Support.