DX Application Performance Management

Running APM extensions as a Windows Service 

Dec 02, 2014 07:59 PM

Unfortunately not all CA APM extensions come with an installer that automatically registers it as a Windows service. But you probably want your EPAgents, CloudMonitor integration, etc. running all the time and automatically restarted if the server goes down.

 

While setting up a daemon under Linux is relatively straightforward (and probably most APM environments are running on Linux or Unix systems) you need other tools and experience to do this under Windows.

 

After some experimenting I decided to go with Apache Commons Daemon. Why? It's open source and works relatively well.

 

commons-logo.png

Relatively means: you have to figure out all the correct parameters . A description can be found here but it took me some experimenting. Therefore I wrote it down for me to remember and to make your life with APM a little easier:

  • Download commons-daemon from the Apache download site
  • Extract it to the same folder as the CA APM extension (in my case APM Integration Pack for CloudMonitor)
  • Run the following commands (or copy & paste it into a file, e.g. service.cmd, and run that):


SETLOCAL

SET COMMAND=install

SET SERVICE_NAME=APMCMINT

SET DISPLAY_NAME="CA APM Integration Pack for CloudMonitor"

SET DESCRIPTION="Integrates CA CloudMonitor into CA APM"

SET CLASSPATH="APMCloudMonitor.jar;.\lib;.\conf"

SET STARTPATH="C:\Program Files\CA APM\APMIntegrationPackForCloudMonitoring9.6.0.0\CloudMon"

SET STARTCLASS=com.wily.apm.cloudmonitor.CloudMonitorAgent

IF NOT DEFINED %JAVA_HOME% SET JAVA_HOME="C:\Program Files\CA APM\APMIntegrationPackForCloudMonitoring9.6.0.0\jre"

 

prunsrv.exe %COMMAND% %SERVICE_NAME% --Startup=auto --DisplayName=%DISPLAY_NAME% --Description=%DESCRIPTION% --Classpath=%CLASSPATH% --StartPath=%STARTPATH% --StartMode=Java --StopMode=Java --StartClass=%STARTCLASS% --JavaHome=%JAVA_HOME%

ENDLOCAL

 

  • Start the service using from the Windows Services management console, by running prunsrv.exe //RS/<service name> or by typing "NET START <service name" in a command prompt.
  • Check the extension log files, the service log in %SystemRoot%\System32\LogFiles\Apache and your APM Webview/Workstation if the extension is running successfully.

 

Again, the parameters are described here but I'll explain them right here:

--Startup=auto: you can also use manual (which is the default) but you want to run the service automatically, don't you?

--DisplayName=%DISPLAY_NAME%: this name is displayed in the Services view

--Description=%DESCRIPTION%: this is the description that is displayed in the Services vie

--Classpath=%CLASSPATH%: this is obviously the Java classpath (relative to the StartPath) and you will probably get it wrong the first time Believe me!

--StartPath=%STARTPATH%: this is the working directory for your service. Relative paths are relative to this - sounds odd somehow!

--StartMode=Java: this worked for me. There are also other modes, see description.

--StopMode=Java: see above.

--StartClass=%STARTCLASS%. Like the %CLASSPATH% you probably have to look it up in the .bat file provided by CA Technologies to start the extension.

--JavaHome=%JAVAHOME%

 

When presented this way it is kind of obvious and self-explanatory but have fun figuring it out on your own?

 

Are you using commons-daemon, too? Or other tools? What is you experience with setting up java as a Windows service?

Statistics
0 Favorited
1 Views
0 Files
0 Shares
0 Downloads

Related Entries and Links

No Related Resource entered.