Freigeben über


Managing Tomcat 7 by extending the JEE Application Server MPs (Part 1 of 2)

 

A new featured in SCOM 2012 is the monitoring of Java Application Servers.  While there are several applications servers that are supported, this posting will focus on Tomcat 7.x support (with some slightly changes, this will work with previous versions, but I'll save that for a different post).

I will present the Management Pack in the next part, this post will focus on describing the Tomcat 7 Manager feature (documented here).  For those unfamilar with Tomcat, the Manager application is an administrative web module that can start and stop applications.  There manager has several different interfaces (GUI, Script, JMX), but of interest is the script interface.  Using this interface it is possible to send HTTP GET requests to start, stop, and restart applications (actually, there are several commands, but for this example I will only focus on these three). 

 Tomcat 7 Permissions

In $CATALINA_HOME\conf\ there is a file called tomcat-users.xml.  In Tomcat 7 the names of the roles changed from the previous versions.  Now the user is required to specify which interface.  The script interface is what is needed.  Edit the file to look like:

 

 <tomcat-users>
 <!--
 NOTE: By default, no user is included in the "manager-gui" role required
 to operate the "/manager/html" web application. If you wish to use this app,
 you must define such a user - the username and password are arbitrary.
 -->
 <role rolename="manager-script"/>
 
 <user username="crammond" password="iamspecial" roles="manager-script"/>
 
 
 </tomcat-users>
 

Tomcat 7 Manager Commands

As stated in the Manager application documentation, here are the commands for controlling a Tomcat 7 application.

Start an Application

 https://localhost:8080/manager/text/start?path=/examples

 

 Stop an Application

 https://localhost:8080/manager/text/stop?path=/examples

 

Restart (aka Reload) an Application

 https://localhost:8080/manager/text/reload?path=/examples
 
 

Summary

In summary, the following data is needed to use the Manager application:

  1. Hostname
  2. Port
  3. User credentials
  4. Path to the application (i.e. context root)

Hostname and port is already available in SCOM 2012 as part of the general JEE application discovery (technically done elsewhere, but the point being an application has access to this information via hosting relationships).  The credentials need to be supplied by the user.  The only gap is the context root of the application.

In the next post I will create an MP that will extend the existing Tomcat 7 JEE application discovery with this additional attribute and provide tasks to start, stop, and restart Tomcat 7 JEE applications.