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
Don't miss your chance to attend the 2014 Nagios World conference!

Don't miss your chance to attend the 2014 Nagios World Conference, Oct 13-16th. Informative Sessions, Networking, Food and Cocktails! Visit go.nagios.com/conference/ for more information or to register.


check_tomcat.pl

Bookmark and Share

Rating
6 votes
Favoured:
3
Current Version
1.4
Last Release Date
2011-12-15
Owner
E-mail
License
GPL
Hits
101425
Files:
FileDescription
check_tomcat.plplugin (Perl script)
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 (3)
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.

#./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.