Wondering how to monitor Apache Tomcat With Nagios XI? We can help you.
As part of our Server Management Services, we assist our customers with similar queries.
Today, let us see how our Support techs assist with this query.
How to monitor Apache Tomcat With Nagios XI?
First and foremost, assuming we have the following:
• A remote Apache Tomcat server with JMX enabled
• Then, a Nagios XI server with a network route to the Apache Tomcat server
Today, let us see the steps followed by our Support Techs for monitoring:
The check_tomcat.jar monitoring plugin is executed either on the Nagios XI server or the Apache Tomcat server.
Plugin Executed From Nagios XI Server
If we intend to run the plugin from the XI server, we have to install Java on the Nagios XI server.
The following commands require us to establish a terminal session to Nagios XI server as the root user.
CentOS/RHEL/Oracle Linux
To install OpenJDK 8 on CentOS/RHEL/Oracle Linux, execute the following command:
yum install -y java-1.8.0-openjdk-devel
Debian 9/Ubuntu 16,18
Then, to install OpenJDK 8 on Debian 9/Ubuntu 16,18, execute the following commands:
apt-get update
apt-get install -y openjdk-8-jdk
Plugin Executed From Remote Tomcat Server
If the plugin is to be remotely executed on the Tomcat server, then NCPA has to be installed on the Tomcat server.
Once installed, we have to download the check_tomcat.jar plugin to the NCPA’s plugins folder.
The plugin can be downloaded directly from the Nagios XI server, in the following commands replace xi_address with the IP address of Nagios XI server.
In a terminal session on the Tomcat server, execute the following commands:
cd /usr/local/ncpa/plugins/
wget http://xi_address/nagiosxi/includes/configwizards/java-as/plugins/check_jvm.jar
The check_tomcat.jar is a Java file that NCPA cannot run by default.
To have NCPA associate .jar files with Java, we have to add a line to the /usr/local/ncpa/etc/ncpa.cfg file.
To edit the ncpa.cfg file, execute the following command:
sudo vi /usr/local/ncpa/etc/ncpa.cfg
Locate the [plugin directives] section by typing this command in:
/[plugin
Scroll down a few lines and find the following line:
.py = python $plugin_name $plugin_args
Insert the following line after the .py line:
.jar = java -jar $plugin_name $plugin_args
If we have several versions of java installed, we have to use an absolute path to the binary in place of java.
If we need to load additional classes for our plugins (not required for JMX over RMI), we have to specify a classpath using -cp between -jar and $plugin_name.
The last step required is to restart the ncpa_listener service.
The command to do this may vary depending on our operating system. In this example, to restart the service on CentOS 7 would be:
systemctl restart ncpa_listener.service
The Apache Tomcat Configuration Wizard
The Apache Tomcat configuration wizard uses JMX (generally over RMI) to retrieve JVM and system statistics and compare them to the thresholds we set in the wizard.
Checks can either be combined into one service or separate.
To begin using the Apache Tomcat configuration wizard, navigate via the top bar to Configure > Configuration Wizards.
Then, select the Apache Tomcat wizard.
Step 1: Provide the details for the Nagios XI server to connect to Tomcat via JMX.
In Tomcat Server Information, specify the following:
• IP Address is the network address of the Tomcat server
• Access Tomcat Server via asks how to access Tomcat statistics. JMX is when Nagios XI connects instead of using NCPA to execute the plugin remotely.
• NCPA Listener Port and NCPA Token only appear when we select the NCPA
access method. We will define these options when installing NCPA.
• Service URL is the URL required to form the JMX connection. For JMX over RMI, this will be of the form
service:jmx:rmi:///jndi/rmi://:/jmxrmi
except in cases where the RMI server is separate from the Tomcat instance.
• Tomcat Username and Tomcat Password are the credentials required to access the JVM’s internal statistics
After making all the selections, click Next.
Step 2: This provides with multiple monitoring options.
In Remote Host Details, we have the choice of defining the Host Name to our requirements.
All the services created by this wizard will be assigned to this newly created host. We also have the option to combine the checks into one service.
In the Heap-Allocated Memory and Non-Heap-Allocated Memory options, simply check and uncheck the relevant boxes to determine which checks to run and enter the desired warning and critical thresholds.
For the Global Request Processors section, we will also need to provide the name of each request processor we wish to monitor.
These names vary from server to server and from version to version of Tomcat.
The correct names can always found by opening a jconsole connection to the Tomcat server, clicking the MBeans tab and then choosing Catalina > GlobalRequestProcessor.
Each of the resulting subdirectories is named for one of the request processors.
In the Other System Statistics options, simply check and uncheck the relevant boxes to determine which checks to run and enter the desired warning and critical thresholds.
Then, click Next and then complete the wizard by choosing the required options.
To finish up, click on Finish in the final step of the wizard.
Once the wizard applies the configuration, click the View status details for link to see the new services that have been created.
[Stuck in between? We are glad to assist you]
Conclusion
In short, today we saw steps followed by our Support Techs to monitor Apache Tomcat With Nagios XI
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments