Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_tomcat.pl

Rating
9 votes
Favoured:
3
Current Version
1.4
Last Release Date
2011-12-15
Owner
License
GPL
Hits
169942
Files:
FileDescription
check_tomcat.plplugin (Perl script)
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
check the tomcat /manager/status page for excessive memory usage or an excessive number of threads in use.
This plugin does a HTTP GET of the tomcat status page:

/manager/status?XML=true

It checks the resulting XML for:

* Low free memory
* Excessive thread usage

Note that although this sounds quite useful, the nature of garbage collection in Java means that this plugin is prone to 'false positives' when reporting memory usage.
ie. it will complain about low memory, which may be fixed by the next garbage collection.
I suggest setting the critical threshold for memory quite low - 50 Mbytes or less.
It is also useful to set the 'max_check_attempts' higher than usual to give garbage collection time to kick in.

This plugin has proved useful in debugging, by picking up the time when a problem started, as distinct from when the tomcat actually failed.

This plugin requires the following perl libraries, available with most Linux distributions or from cpan.org
LWP - The World-Wide Web library for Perl
XML::XPath - for parsing and evaluating XPath statements

These are possibly packaged as:
perl-libwww-perl
perl-XML-XPath

v1.2 released 2011-11-30 can check any connector-name.
If invoked with '-n .' will check ALL connectors mentioned in the XML status report.

v1.3 released 2011-12-15 adds currentThreadCount to the performance data reported by this plugin.

v1.4 released 2013-03-15 fixes a bug where the warning and critical values for threads was not being correctly calculated on the second and subequent connectors. Also changed MB to MiB.
Reviews (4)
byjose.a.guardia, May 30, 2016
It works on CentOS 6.4 + Tomcat 7.0.69
#./check_tomcat_test.pl -H -p -l -a -u '/manager/status?XML=true'

Running above command throws below error;
PositionContext: Parse position is outside of buffer at /usr/local/lib64/perl5/XML/Parser/Expat.pm line 344.

Running with verbose getting;

Connecting to :
--------------- GET http://:/manager/status?XML=true
Host: :
User-Agent: libwww-perl/5.833
---------------
HTTP/1.1 200 OK
Cache-Control: private
Connection: close
Date: Date
Server: Apache-Coyote/1.1
Content-Length: 2442
Content-Type: text/xml;charset=utf-8
Expires: Thu, 01 Jan 1970 01:00:00
Client-Date: DATE
Client-Peer: :
Client-Response-Num: 1
Content has 2442 bytes
PositionContext: Parse position is outside of buffer at /usr/local/lib64/perl5/XML/Parser/Expat.pm line 344.
bysridhar21s, October 28, 2012
This works great with tomcat 7.
byunique, October 26, 2011
2 of 2 people found this review helpful
It is not working with tomcat 7 ... It would be great if you can fix this issue. Thanks!
Owner's reply

tomcat7 changed the default connector name from http-8080 to "http-bio-8080", and added an additional level of quotes (!).

v1.2 of the plugin now allows arbitrary connector names, and strips off the quotes.