Skip to content

viniciusfs/check_tomcat.py

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 

Repository files navigation

check_tomcat.py

Check tomcat server plugin for nagios

Author: Daniel Dueñas Domingo (dduenasd@gmail.com)

Version 2.0

Description

This plugin uses the tomcat manager webapp, this app usually is located in the URL: http://tomcat-host-name:xxxx/manager which "tomcat-host-name" is the dns name or ip of the tomcat server and "xxxx" is the port number of the tomcat service (the tomcat port is 8080 by default) This plugin works in tomcat6 and tomcat7 versions, i don't know if works in previous versions. This plugin can monitorize this items: 1- tomcat server status 2- tomcat server memory 3- tomcat server thread connectors 4- application status on tomcat server

This plugin uses the nagios plugin python template in https://github.com/dduenasd/nagios_plugin_template_python

Requirements

  • python 2 Python must be installed in nagios server. I use python 2.7, python 3 is not tested for this plugin.
  • Tomcat Manager Webapp The tomcat server for monitorize must be installed the manager web app The documentation of the manager of tomcat:

Installation

Nagios Server: Copy check_tomcat.py file to a plugins nagios directory, usually in this path: /usr/local/nagios/libexec

Tomcat Server: You must define a user for access to the manager webapp, the instructions for define an user:

Use

First, we must test the plugin in the nagios server, in console, we can execute the plugin:

$/path_nagios_libexec/check_tomcat.py

This command show the use of the plugin, with:

$/path_nagios_libexec/check_tomcat.py -h

Show the help

If I have a Tomcat Server with IP 10.20.40.20 and port 8080, for test the plugin, I can execute:

$/path_nagios_libexeccheck_tomcat.py -H 10.20.40.20 -p 8080 -u nagioscheck -a pass -m status

where 10.20.40.20 is the ip of the tomcat server, nagioscheck and pass are the credentials of tomcat manager, command output would be something like:

OK  Apache Tomcat/7.0.53 server is OK

If output is an error, you can execute the command with -v, -vv or -vvv for verbose output, this can help you to find the problem.

You must define a command in commands.cfg for nagios, an example:


define command {
	command_name   check_tomcat
	command_line   $USER1$/check_tomcat.py -H $HOSTADDRESS$ -u $USER10$ -p $ARG1$ -a $USER12$ -U $ARG2$ -m $ARG3$ $ARG4$ $ARG5$ $ARG6$
	register       1
}	

Now, you can define a service in a service configuration file (services.cfg for example) for check, for example, the tomcat server memory:


define service {
	host_name                      	TOMCAT_SERVER
	service_description            	Tomcat Server Memory
	use                            	servicio-generico
	check_command                  	check_tomcat!8080!/manager!mem!-w 80 -c 90
	contact_groups                 	grupo-sistemas
	icon_image                     	../logos2/tomcat.png
	register                       	1
}	

Note: In the example, a lot of required parameters are defined in the template "servicio-generico"

About

This is a nagios plugin to monitorize tomcat servers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%