Monitor Tomcat Running as a Windows Service with SCOM

In this post I want to detail my experience monitoring Tomcat with SCOM 2012.  In my case the application servers were Windows Server 2008 R2 running Tomcat 7 as a windows service. When Tomcat is running as a windows service SCOM does not automatically detect the Tomcat instance. So this blog post will focus around monitoring Tomcat Running as windows service and the steps you have to take to get this working.

 

There are two other things you need to take care of that I do not cover in this post. These are:

 

#1 The application servers that are hosting your Tomcat need to have the Agent Proxy enabled.

See this link on how to do this:

http://technet.microsoft.com/en-us/library/hh264858.aspx

or this link to enable proxy for all agents:

http://www.bictt.com/blogs/bictt.php/2012/08/24/scom-2012-enable-agent-proxy

 

#2 You will need to deploy BeanSpy to your Tomcat server first.

See step 5 of this post on how to do this:

http://blogs.catapultsystems.com/cfuller/archive/2012/03/26/operations-manager-2012-scom-lab-testing-monitoring-for-jee-components-tomcat-on-windows.aspx

 

BeanSpy is a WAR file. WAR files are used  to deploy web applications to Tomcat.

BeanSpy is essentially a web application deployed to Tomcat that SCOM uses to gather data. 

 

After you deploy BeanSpy  verify that it is working. Access this URL:

 

http://TOMCATSERVERNAME:8080/BeanSpy/Stats

 

If an XML page such as the one in the following screenshot appears then we have verified BeanSpy is working.

 

clip_image001

 

You can also view BeanSpy by accessing the web manager using this URL:

 

http://TOMCATSERVERNAME:8080/manager

 

clip_image002

 

 

Here are the steps to configure SCOM to monitor Tomcat running as a windows service:

 

Download OpsMgr_MP_Tomcat.docx and SC2012OM_JEE_MP.msi. from:

http://www.microsoft.com/en-us/download/details.aspx?id=29270

 

Run SC2012OM_JEE_MP.msi. This will extract all JEE management packs.

 

Now that the management packs are extracted. Import these JEE Monitoring packs into SCOM 2012 for Tomcat:

 

         Libraries monitoring packs:

             Microsoft.JEE.Library.mpb

             Microsoft.JEE.Templates.Library.mpb

 

         Tomcat monitoring packs:

             Microsoft.JEE.Tomcat.Library.mp

             Microsoft.JEE.Tomcat.5.mp

             Microsoft.JEE.Tomcat.6.mp

             Microsoft.JEE.Tomcat.7.mp

 

(NOTE: Only import MP’s for your version/s of Tomcat.)

 

As stated in the beginning of this post Tomcat running as a windows service will not automatically be discovered.

The following two screenshots demonstrate what you will see.

 

clip_image003

 

clip_image004

 

There are two options to discover the Tomcat servers when they are running as a windows service.

 

#1 Run your Tomcat instances as a process instead of a Windows service.

#2 Use some PowerShell scripts to discover the Tomcat instances.

 

In this post we are going to go with

 

Next you will need to use some PowerShell scripts to add the Tomcat servers. You will need these PowerShell scripts:

 

    JEEAppServerLibrary.ps1

    NewJEEAppServer.ps1

    RemoveJEEAppServer.ps1 

 

Read more