I wrote a simple nagios plugin to check the status of tomcat webapps.
Instead of looking pages like this one…
I’d better to use some script like this.
To put the plugin in the nagios environment, add these lines
define command{
command_name check_tomcat_app
command_line /bin/bash /usr/lib/nagios/plugins/check_tomcat_app $ARG1$ $ARG2$ $ARG3$
}
to the commands.cfg file definitions.Then add some line like theese
define service{
use generic-service
host_name myhostname
service_description Examples Web Service
is_volatile 0
check_period 24×7
max_check_attempts 3
normal_check_interval 15
retry_check_interval 1
contact_groups admins
notification_interval 240
notification_period 24×7
notification_options c,r
check_command check_tomcat_app!”http://tomcatserver.my.lan:8080/manager/html/list”!Examples!admin:passw
}
into the services.cfg file.
Off corse username and password has to be set up in tomcat-users.xml file
$ cat /usr/local/apache-tomcat/conf/tomcat-users.xml
<?xml version=’1.0′ encoding=’utf-8′?>
<tomcat-users>
<role rolename=”manager”/>
<role rolename=”admin-gui”/>
<role rolename=”manager-gui”/>
<role rolename=”manager-status”/>
<user username=”admin” password=”passw” roles=”manager,manager-gui,manager-status,admin-gui”/>
</tomcat-users>