check_jmxproxy.pl
A plugin that queries mbean information through tomcats JMXProxyServlet, parses the result and returns name-value pairs for values of type integer (values of type integer inside of type CompositeDataSupport will also be parsed).
Usage:
check_jmxproxy.pl -U [jmxqryurl] [-r realm] [-u username] [-p password] [-e enable] [-c critical list] [-w warning list] [-h] [-V] [-v]
Options:
Flag | Description |
---|---|
-c | --critical | [threshold1],[threshold2],... comma-separated list of threshholds in order of results, fields may be empty |
-w | --warning | [threshold1],[threshold2],... comma-separated list of threshholds in order of results, fields may be empty |
-r | --realm | authentication realm normaly "Tomcat Manager Application" |
-u | --username | the user defined in tomcat-users.xml for the manager app |
-p | --password | |
-e | --enable attribute1,attribute2,... | enables list of attributes if this option ist set, all not explicitly enabled attributes are disabled. |
-V | --version | |
-v | --verbose |
Example:
Query all memory values from mbean java.lang:type=Memory: (tomcat has to be started with -Dcom.sun.management.jmxremote)
./check_jmxproxy.pl -U "http://192.168.0.1:8080/manager/jmxproxy?qry=java.lang:type=Memory" -r "Tomcat Manager Application" -u nagios -p "geheim"
Query the number of threads of a listener:
./check_jmxproxy.pl -U "http://192.168.0.2:8080/manager/jmxproxy?qry=Catalina:type=ThreadPool,name=jk-8009" -r "Tomcat Manager Application" -u nagios -p "geheim" -e currentThreadCount,currentThreadsBusy,minSpareThreads -w 200,100,, -c 300,200
Returned performance data can be used by PNP. For each returned name-value pair a warning and/or critical threshold can be defined.
There are also plugins for monitoring jmx directly (e.g. check_jmx), but sometimes it is easier to make HTTP requests from nagios to tomcat servers than to enable jmx communication through firewalls.
See manager-howto.html from tomcat documentation for how to enable and use jmxproxy.
One should always keep in mind, that enabling read access to jmxproxy allows also write access to the beans.