0% found this document useful (0 votes)
116 views7 pages

Apache Tomcat With Nagios XI PDF

Uploaded by

Hari Haran M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views7 pages

Apache Tomcat With Nagios XI PDF

Uploaded by

Hari Haran M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

The Industry Standard In Infrastructure Monitoring

Nagios XI How To Monitor Apache Tomcat With Nagios XI

Purpose
This document will cover how to monitor Apache Tomcat servers using the Apache Tomcat
wizard and check_tomcat.jar plugin within Nagios XI, so that users may be notified when
Java applications are behaving unexpectedly.

Target Audience
This document is intended for use by Nagios XI Administrators who want to monitor their Apache Tomcat
instances.

Prerequisites
This document is assumes you have the following:
• A remote Apache Tomcat server with JMX enabled
• A Nagios XI server with a network route to the Apache Tomcat server

The check_tomcat.jar monitoring plugin is executed either on the Nagios XI server or the Apache Tomcat
server. Either method requires some prerequisite steps to be followed first which are outlined below.

Plugin Executed From Nagios XI Server


If you intend to run the plugin from the XI server, you’ll need to install Java on the Nagios XI server. At the
time of this writing, any Java 7+ implementation should work with the check_tomcat.jar plugin, but only
Oracle Java and OpenJDK have been tested. The following commands require you to establish a terminal
session to your 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

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

www.nagios.com
© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or
registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner. Page 1 / 7
Updated – June, 2018
The Industry Standard In Infrastructure Monitoring

Nagios XI How To Monitor Apache Tomcat With Nagios XI

Debian 8 / Ubuntu 14
To install OpenJDK 7 on Debian 8 / Ubuntu 14 execute the following commands:

apt-get update
apt-get install -y openjdk-7-jdk

Debian 9 / Ubuntu 16,18


To install OpenJDK 8 on Debian 9 / Ubuntu 16,18 execute the following commands:

apt-get update
apt-get install -y openjdk-8-jdk

Once these steps have been performed please proceed to the Configuration Wizard section of this document.

Plugin Executed From Remote Tomcat Server


If the plugin is to be remotely executed on the Tomcat server then NCPA will need to be installed on the
Tomcat server as per the Installing NCPA documentation.

Once installed you will need 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 your 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 you will need to add a line to the /usr/local/ncpa/etc/ncpa.cfg file.

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

www.nagios.com
© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or
registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner. Page 2 / 7
Updated – June, 2018
The Industry Standard In Infrastructure Monitoring

Nagios XI How To Monitor Apache Tomcat With Nagios XI

To edit the ncpa.cfg file execute the following command:

sudo vi /usr/local/ncpa/etc/ncpa.cfg

When using vi, to make changes press i on the keyboard first to enter insert mode and press Esc to exit
insert mode.

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

When you have finished, save the changes in vi by typing:


:wq
and press Enter.

If you have several versions of java installed, you may want to use an absolute path to the binary in place of
java. If you need to load additional classes for your plugins (not required for JMX over RMI), you may want
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 your operating system (full details can be found in the Installing NCPA documentation). In this

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

www.nagios.com
© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or
registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner. Page 3 / 7
Updated – June, 2018
The Industry Standard In Infrastructure Monitoring

Nagios XI How To Monitor Apache Tomcat With Nagios XI

example to restart the service on CentOS 7 would be:

systemctl restart ncpa_listener.service

Once these steps have been performed please proceed to the Configuration Wizard section of this document.

The Apache Tomcat Configuration Wizard


The Apache Tomcat config wizard uses JMX (generally over RMI) to retrieve JVM and system statistics and
compare them to the thresholds you set in the wizard. Checks can either be combined into one service or
separated.

To begin using the Apache Tomcat configuration wizard, navigate via the top bar to Configure >
Configuration Wizards. Then, select the Apache Tomcat wizard. In the following screenshot you can see
how the search field allows you to quickly find a wizard.

Step 1 requires you to provide the details for the Nagios XI server to connect to Tomcat via JMX.

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

www.nagios.com
© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or
registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner. Page 4 / 7
Updated – June, 2018
The Industry Standard In Infrastructure Monitoring

Nagios XI How To Monitor Apache Tomcat With Nagios XI

In Tomcat Server Information, specify the


following:
• IP Address is the network address of the
Tomcat server
• Access Tomcat Server via asks you 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 you select the NCPA
access method. You defined these options
when installing NCPA earlier.
• 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://<host>:<port>/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 your selections click Next to proceed to Step 2.

Step 2 provides you with multiple monitoring options.

In Remote Host Details you have the choice of defining


the Host Name to your requirements. All the services
created by this wizard will be assigned to this newly
created host. You also have the option to combine the
checks into one service.

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

www.nagios.com
© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or
registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner. Page 5 / 7
Updated – June, 2018
The Industry Standard In Infrastructure Monitoring

Nagios XI How To Monitor Apache Tomcat With Nagios XI

The Heap-Allocated Memory and Non-


Heap-Allocated Memory options are self
explanatory, simply check and un-check the
relevant boxes to determine which checks to
run, and enter your desired warning and
critical thresholds.

For the Global Request


Processors section, you
will also need to provide the
name of each request
processor you wish to
monitor. These names vary from server to server and from version to version of Tomcat. The correct names
can always be 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.

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

www.nagios.com
© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or
registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner. Page 6 / 7
Updated – June, 2018
The Industry Standard In Infrastructure Monitoring

Nagios XI How To Monitor Apache Tomcat With Nagios XI

The Other System Statistics options are self


explanatory, simply check and un-check the relevant
boxes to determine which checks to run, and enter
your desired warning and critical thresholds.

Click Next and then complete the wizard by choosing


the required options in Step 3 – Step 5.

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 <your host> link to see the new
services that have been created.

Finishing Up
This completes the documentation on how to monitor Apache Tomcat in Nagios XI.
If you have additional questions or other concerns, please visit us at our support forums:

https://support.nagios.com/forum

The Nagios Support Knowledgebase is also a great support resource:

https://support.nagios.com/kb

1295 Bandana Blvd N, St. Paul, MN 55108 [email protected] US: 1-888-624-4671 INTL: 1-651-204-9102

www.nagios.com
© 2017 Nagios Enterprises, LLC. All rights reserved. Nagios, the Nagios logo, and Nagios graphics are the servicemarks, trademarks, or
registered trademarks owned by Nagios Enterprises. All other servicemarks and trademarks are the property of their respective owner. Page 7 / 7
Updated – June, 2018

You might also like