Apache Tomcat

Apache Tomcat is an open-source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and WebSocket technologies. Tomcat provides a "pure Java" HTTP web server environment in which Java code can run.

Available solutions




This template is for Zabbix version: 5.4
Also available for: 5.0

Source: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/app/tomcat_jmx?at=release/5.4

Apache Tomcat JMX

Overview

For Zabbix version: 5.4 and higher
Official JMX Template for Apache Tomcat.

This template was tested on:

  • Apache Tomcat, version 8.5.59
  • Zabbix, version 5.4

Setup

See Zabbix template operation for basic instructions.

Metrics are collected by JMX.

  1. Enable and configure JMX access to Apache Tomcat. See documentation for instructions (chose your version).
  2. If your Tomcat installation require authentication for JMX, set values in host macros {$TOMCAT.USERNAME} and {$TOMCAT.PASSWORD}.
  3. You can set custom macro values and add macros with context for specific metrics following macro description.

Zabbix configuration

No specific Zabbix configuration is required.

Macros used

Name Description Default
{$TOMCAT.LLD.FILTER.MATCHES}

Filter for discoverable objects. Can be used with following contexts: "GlobalRequestProcessor", "ThreadPool", "Manager"

.*
{$TOMCAT.LLD.FILTER.NOT_MATCHES}

Filter to exclude discovered objects. Can be used with following contexts: "GlobalRequestProcessor", "ThreadPool", "Manager"

CHANGE IF NEEDED
{$TOMCAT.PASSWORD}

Password for JMX

``
{$TOMCAT.THREADS.MAX.PCT}

Threshold for busy worker threads trigger. Can be used with {#JMXNAME} as context.

75
{$TOMCAT.THREADS.MAX.TIME}

The time during which the number of busy threads can exceed the threshold. Can be used with {#JMXNAME} as context.

5m
{$TOMCAT.USER}

User for JMX

``

Template links

There are no template links in this template.

Discovery rules

Name Description Type Key and additional info
Global request processors discovery

Discovery for GlobalRequesProcessor

JMX jmx.discovery[beans,"Catalina:type=GlobalRequestProcessor,name=*"]

Filter:

AND

- A: {#JMXNAME} MATCHES_REGEX {$TOMCAT.LLD.FILTER.MATCHES:"GlobalRequesProcessor"}

- B: {#JMXNAME} NOT_MATCHES_REGEX {$TOMCAT.LLD.FILTER.NOT_MATCHES:"GlobalRequesProcessor"}

Protocol handlers discovery

Discovery for ProtocolHandler

JMX jmx.discovery[attributes,"Catalina:type=ProtocolHandler,port=*"]

Filter:

AND

- A: {#JMXATTR} MATCHES_REGEX ^name$

Thread pools discovery

Discovery for ThreadPool

JMX jmx.discovery[beans,"Catalina:type=ThreadPool,name=*"]

Filter:

AND

- A: {#JMXNAME} MATCHES_REGEX {$TOMCAT.LLD.FILTER.MATCHES:"ThreadPool"}

- B: {#JMXNAME} NOT_MATCHES_REGEX {$TOMCAT.LLD.FILTER.NOT_MATCHES:"ThreadPool"}

Contexts discovery

Discovery for contexts

JMX jmx.discovery[beans,"Catalina:type=Manager,host=,context="]

Filter:

AND

- A: {#JMXHOST} MATCHES_REGEX {$TOMCAT.LLD.FILTER.MATCHES:"Manager"}

- B: {#JMXHOST} NOT_MATCHES_REGEX {$TOMCAT.LLD.FILTER.NOT_MATCHES:"Manager"}

Items collected

Group Name Description Type Key and additional info
Tomcat Tomcat: Version

The version of the Tomcat.

JMX jmx["Catalina:type=Server",serverInfo]

Preprocessing:

- DISCARD_UNCHANGED_HEARTBEAT: 1d

Tomcat {#JMXNAME}: Bytes received per second

Bytes received rate by processor {#JMXNAME}

JMX jmx[{#JMXOBJ},bytesReceived]

Preprocessing:

- CHANGE_PER_SECOND

Tomcat {#JMXNAME}: Bytes sent per second

Bytes sent rate by processor {#JMXNAME}

JMX jmx[{#JMXOBJ},bytesSent]

Preprocessing:

- CHANGE_PER_SECOND

Tomcat {#JMXNAME}: Errors per second

Error rate of request processor {#JMXNAME}

JMX jmx[{#JMXOBJ},errorCount]

Preprocessing:

- CHANGE_PER_SECOND

Tomcat {#JMXNAME}: Requests per second

Rate of requests served by request processor {#JMXNAME}

JMX jmx[{#JMXOBJ},requestCount]

Preprocessing:

- CHANGE_PER_SECOND

Tomcat {#JMXNAME}: Requests processing time

The total time to process all incoming requests of request processor {#JMXNAME}

JMX jmx[{#JMXOBJ},processingTime]

Preprocessing:

- MULTIPLIER: 0.001

Tomcat {#JMXVALUE}: Gzip compression status

Gzip compression status on {#JMXNAME}. Enabling gzip compression may save server bandwidth.

JMX jmx[{#JMXOBJ},compression]

Preprocessing:

- DISCARD_UNCHANGED_HEARTBEAT: 1h

Tomcat {#JMXNAME}: Threads count

Amount of threads the thread pool has right now, both busy and free.

JMX jmx[{#JMXOBJ},currentThreadCount]

Preprocessing:

- DISCARD_UNCHANGED_HEARTBEAT: 10m

Tomcat {#JMXNAME}: Threads limit

Limit of the threads count. When currentThreadsBusy counter reaches the maxThreads limit, no more requests could be handled, and the application chokes.

JMX jmx[{#JMXOBJ},maxThreads]

Preprocessing:

- DISCARD_UNCHANGED_HEARTBEAT: 10m

Tomcat {#JMXNAME}: Threads busy

Number of the requests that are being currently handled.

JMX jmx[{#JMXOBJ},currentThreadsBusy]
Tomcat {#JMXHOST}{#JMXCONTEXT}: Sessions active

Active sessions of the application.

JMX jmx[{#JMXOBJ},activeSessions]
Tomcat {#JMXHOST}{#JMXCONTEXT}: Sessions active maximum so far

Maximum number of active sessions so far.

JMX jmx[{#JMXOBJ},maxActive]
Tomcat {#JMXHOST}{#JMXCONTEXT}: Sessions created per second

Rate of sessions created by this application per second.

JMX jmx[{#JMXOBJ},sessionCounter]

Preprocessing:

- CHANGE_PER_SECOND

Tomcat {#JMXHOST}{#JMXCONTEXT}: Sessions rejected per second

Rate of sessions we rejected due to maxActive being reached.

JMX jmx[{#JMXOBJ},rejectedSessions]

Preprocessing:

- CHANGE_PER_SECOND

Tomcat {#JMXHOST}{#JMXCONTEXT}: Sessions allowed maximum

The maximum number of active Sessions allowed, or -1 for no limit.

JMX jmx[{#JMXOBJ},maxActiveSessions]

Triggers

Name Description Expression Severity Dependencies and additional info
Tomcat: Version has been changed

Tomcat version has changed. Ack to close.

{TEMPLATE_NAME:jmx["Catalina:type=Server",serverInfo].diff()}=1 and {TEMPLATE_NAME:jmx["Catalina:type=Server",serverInfo].strlen()}>0 INFO

Manual close: YES

{#JMXVALUE}: Gzip compression is disabled

gzip compression is disabled for connector {#JMXVALUE}.

{TEMPLATE_NAME:jmx[{#JMXOBJ},compression].str(off)} = 1 INFO

Manual close: YES

{#JMXNAME}: Busy worker threads count are more than {$TOMCAT.THREADS.MAX.PCT:"{#JMXNAME}"}% of the limit for {$TOMCAT.THREADS.MAX.TIME:"{#JMXNAME}"}

When current threads busy counter reaches the limit, no more requests could be handled, and the application chokes.

{TEMPLATE_NAME:jmx[{#JMXOBJ},currentThreadsBusy].min({$TOMCAT.THREADS.MAX.TIME:"{#JMXNAME}"})}>{Apache Tomcat JMX:jmx[{#JMXOBJ},maxThreads].last()}*{$TOMCAT.THREADS.MAX.PCT:"{#JMXNAME}"}/100 HIGH

Feedback

Please report any issues with the template at https://support.zabbix.com

You can also provide a feedback, discuss the template or ask for help with it at ZABBIX forums.

Articles and documentation

+ Propose new article

Didn't find what you are looking for?