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.
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):
SET DISPLAY_NAME="CA APM Integration Pack for CloudMonitor"
SET DESCRIPTION="Integrates CA CloudMonitor into CA APM"
SET STARTPATH="C:\Program Files\CA APM\APMIntegrationPackForCloudMonitoring184.108.40.206\CloudMon"
IF NOT DEFINED %JAVA_HOME% SET JAVA_HOME="C:\Program Files\CA APM\APMIntegrationPackForCloudMonitoring220.127.116.11\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%
- 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.