Tomcat enterprise plugin

With this plug-in we can see the Tomcast stats.

Introduction

Ver. July 2021

With this plug-in we can see the Tomcast stats.

This document explains how to monitor a Tomcat server through the PandoraFMS plugin.
The compatibility matrix for the plugin is shown below:

Systems where it has been tested
Tomcat 6
Tomcat 7
Tomcat 8
Tomcat 9
Systems where it should work
Tomcat 6.x and above

Change log

Date Author Change Version
09/05/12 Tomas First Version v1r1
21/12/12 Tomas Bug fixed v1r2
14/01/12 Tomas Bug fixed v1r3
12/02/15 MarioP Bug fixed v1r5
14/04/16 Borja New schema v2r1

 

Enviromental configuration

The documentation to be provided by the area requesting the monitoring is:
- host: Server hosting the Tomcat service.
- port: Port on which Tomcat is listening.
- user: user to authenticate to Tomcat.
- pass: password to authenticate to Tomcat.
- https: https (1) or http (0) mode.
- Have the necessary permissions so that from the machine itself you can make a curl to the page
page in question (a username and password in tomcat-users.xml enabled to access the content of the page).
page).
The user must be configured to have the manager-script role, which can also see the list of instances.

<user username="user" password="password" roles="manager-script" />

This part of the tomcat-users.xml file looks like this:

<tomcat-users>
<!-- otros roles -->
<role rolename="manager-script"/>
<!-- otros usuarios -->
<user username="username" password="password" roles="manager-script" />
</tomcat-users>

- Enable access to this page as well as roles to assign to users so that they can obtain its content.
content.
- Know Tomcat version to know the scope of monitoring (compatibility mode, for versions <= 6.
versions <= 6.X).

Installation

To retrieve all the data from Tomcat you will need:

- To have curl in the agent/ probe where the plugin will be launched. Pandora FMS Agent provides this utility.
- Have the permissions to ask the web service. (Firewall rules, user & password, etc.)

The role needed for the plugin to get the information from Tomcat is “manager-script”:

<user username="user" password="password" roles="manager-script" />

All the information is retrieved from the Tomcat manager application. Is mandatory to have it
enabled in order to monitor the service.

http://<Tomcat-IP-Address><Puerto>/manager/status?XML=true
http://<Tomcat-IP-Address><Puerto>/manager/text/list

Note: Tomcat’s default TCP Port: 8080


In case you could find any issue connecting to the service, you can add a new connector to the Tomcatserver. Following you can find a configuration example:

/etc/tomcat<version>/server.xml

image-1643036449902.png

Pandora FMS plugin for Tomcat service monitoring. Example configuration:

## User grants needed:
## v6 - manager-script
## v7 - manager-script
## v8 - manager-script
## v9 - manager-script
host=ahorcado.lab.artica.es
port=8080
user=admin
pass=pandora
## set to 1 if you use https instead of http
https=0
## if you want to ignore host:port config default, you could define a custom url:
#custom_url=http://myserver:myport/mymap/
## Module personalization
MODULE_GROUP=Tomcat
MODULE_TAGS=Network,Application
MODULE_INTERVAL=1
## Extra identifier (identifies the modules of current instance)
instance=T6
####### Personalize execution
## values 1 (tomcat version <= 6.X) or 0 (tomcat version > 6.X)
#compatibility_mode=1
#---------------------
#- monitoring status -
#---------------------
enable_application_scan=1
enable_status_monitoring=1
#personalize each section
enable_thread_monitoring=1
enable_requestInfo_monitoring=1
enable_workers_monitoring=1
#----------
#- vminfo -
#----------
enable_vminfo_memory_information=1
#JVM
enable_jvm_memory_monitoring=1
enable_jvm_memorypool_monitoring=1

As we had configured the file with the values corresponding to our environment, we can deploy the files to the Pandora FMS agent by using file collections.


It is a good practice to test the execution before deploy the plugin for first time.

Plugin execution configuration (agent configuration file):

module_plugin perl /path/to/file/pandora_tomcat.pl /path/to/file/pandora_tomcat.conf

Binary files are also deployed for Windows Pandora FMS agents (pandora_tomcat_x86.exe and
pandora_tomcat_x64.exe)

module_plugin /path/to/file/pandora_tomcat_xXX.exe /path/to/file/pandora_tomcat.conf

 

 

Modules generated by the plugin

Following is the module list the plugin retrieves from a Tomcat server:


Where [T6] is a user customizable tag (instance)

[T6][<APPNAME>] Status]
[T6][<APPNAME>] Sessions]
[T6]["http-nio-1009"] maxThreads
[T6]["http-nio-1009"] currentThreadsBusy
[T6]["http-nio-1009"] currentThreadCount
[T6]["http-nio-1009"] Threading usage
[T6]["http-nio-1009"] bytesReceived
[T6]["http-nio-1009"] bytesSent
[T6]["http-nio-1009"] processingTime
[T6]["http-nio-1009"] maxTime
[T6]["http-nio-1009"] errorCount
[T6]["http-nio-1009"] requestCount
[T6][workers] Current requests
[T6][workers] Current BytesReceived
[T6][workers] Current BytesSent
[T6]["ajp-nio-8909"] maxThreads
[T6]["ajp-nio-8909"] currentThreadsBusy
[T6]["ajp-nio-8909"] currentThreadCount
[T6]["ajp-nio-8909"] Threading usage
[T6]["ajp-nio-8909"] bytesReceived
[T6]["ajp-nio-8909"] bytesSent
[T6]["ajp-nio-8909"] errorCount
[T6]["ajp-nio-8909"] requestCount
[T6]["ajp-nio-8909"] processingTime
[T6]["ajp-nio-8909"] maxTime
[T6][workers] Current requests
[T6][workers] Current BytesReceived
[T6][workers] Current BytesSent
[T6][Memory] Heap usage
[T6][Memory] Heap committed
[T6][Memory] Non-Heap used
[T6][Memory] Non-Heap committed
[T6][Memory] Non-Heap max
[T6][Code Cache] Pool usage
[T6][Code Cache] Pool commited
[T6][Metaspace] Pool usage
[T6][Metaspace] Pool commited
[T6][Compressed Class Space] Pool usage
[T6][Compressed Class Space] Pool commited
[T6][PS Eden Space] Pool usage
[T6][PS Eden Space] Pool commited
[T6][PS Survivor Space] Pool usage
[T6][PS Survivor Space] Pool commited
[T6][PS Old Gen] Pool usage
[T6][PS Old Gen] Pool commited