Managing Tomcat 6 by extending the JEE Application Server MPs

Previously, I wrote two posting regarding how to extend the JEE MPs to start, stop, and restarting Tomcat 7.x applications (Tomcat 7 Posting: Part 1 Part 2). This post will do the same for Tomcat 6.  Rather than re-state what was previously posted, here I will just highlight the differences for 6.x support.

Interface to Tomcat Manager

With the release of Tomcat 7, the interface to the manager changed.  For older versions of Tomcat there is not a distiction between the type of access to the manager application (i.e. text, gui, etc...).  This means there is a slight difference in the URL to start/stop/restart a deployed Tomcat 6.x application.

  <!-- Stop an existing Tomcat Application via: -->
 <!-- http(s)://{hostname}:{portnumber}/manager/stop?path={context_path} -->
 <Task ID="Contoso.JEE.Tomcat.Six.Stop.Task" Accessibility="Public"
 Enabled="true" Target="Contoso.JEE.Tomcat.Six.Application" Remotable="true">
 <Category>Maintenance</Category>
 <ProbeAction ID="Probe" TypeID="Contoso.JEE.Tomcat.Six.HttpGet.UrlProbe.GetRequestBody.ProbeAction">
 <ComputerName>$Target/Host/Property[Type="JEE!Microsoft.JEE.ApplicationServer.Monitored.Instance"]/HostName$</ComputerName>
 <Protocol>$Target/Host/Property[Type="JEE!Microsoft.JEE.ApplicationServer.Monitored.Instance"]/Protocol$</Protocol>
 <Port>$Target/Host/Property[Type="JEE!Microsoft.JEE.ApplicationServer.Monitored.Instance"]/Port$</Port>
 <URL>/manager/stop?path=$Target/Property[Type="Contoso.JEE.Tomcat.Six.Application"]/ContextPath$</URL>
 <TimeoutSeconds>10</TimeoutSeconds>
 </ProbeAction>
 </Task>

Note: there is a different URL path than Tomcat 7.

Different MBean Name

The names of the MBeans class (and packages) representing Web Modules are different between Tomcat 7 and Tomcat 6.  In Tomcat 6, the correct class name is org.apache.tomcat.util.modeler.BaseModelMBean.  It so happens that the MP logic contains some filtering, thus the appropriate strings have been changed.

Deployment

Again, I have done all of this work for you.  All you need to do is import the attached MP and add the appropriate credential information.

In SCOM Console, go to Administration > Run As Configuration > Accounts and choose the task to Create Run As Account.  Create a new Basic Authentication Run As Account with credentials that are appropriate for your Tomcat 6 instance(s).  For details about setting up a manager account. see https://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html.

Next go to Administration > Run As Configuration > Profiles, select the Privileged Tomcat 6.x Account, and right-click and choose Properties. Associate the Account create above with the Profile.

Now all that is necessary is for the discovery to occur.  Due the internals of how SCOM works, this will occur one application at a time (recall that I mentioned above that the discovery needs to run for each application).  When the discovery has occured you will three tasks for a selected application to start, stop, and restart the application.

Tomcat.Six.Tasks.xml