Friday, June 19, 2009

OpenNMS as a Windows Service

[I've updated this some, to correct errors and be more thorough]

I'm doing some testing with OpenNMS, to see if it is at least good enough. So far, it is.

One of the complications is that it is a java app. This would be fine, except it doesn't ship with a means of running it as a Windows service. All in all, it wasn't too bad. I got it running on Windows 2003 Server - I haven't tried 2008, yet.

All of this assumes that you have OpenNMS itself working.

I started with the instructions here, using "Method One".

The abbreviated version of those instructions is that inside the downloaded .zip file, there's a file structure which looks like the one in your OpenNMS directory.

Unzip that to someplace other than your OpenNMS directory - I know how you people are - so we can make some changes.

Delete the ./src directory. If you're reading this, you aren't using that.

In the ./bin directory, there's a bunch of batch files. I renamed them "WrapperInstall.bat", "WrapperStart.bat", etc., because that's just easier to keep track of.

In ./conf, there's a file named wrapper.conf. Try using this one, but double-check the directory names....

#********************************************************************
# Wrapper License Properties (Ignored by Community Edition)
#********************************************************************
# Include file problems can be debugged by removing the first '#'
# from the following line:
##include.debug
#include ../conf/wrapper-license.conf
#include ../conf/wrapper-license-%WRAPPER_HOST_NAME%.conf

#********************************************************************
# Wrapper Java Properties
#********************************************************************
wrapper.java.command=C:\Program Files\Java\jdk1.6.0_14\bin\java
wrapper.java.additional.1=-Xmx256m
wrapper.java.additional.2=-Dopennms.home="C:/PROGRA~1/OpenNMS"

wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
wrapper.app.parameter.1= org.opennms.bootstrap.Bootstrap
wrapper.app.parameter.2= start

wrapper.java.classpath.1=C:/Program Files/Java/jdk1.6.0_14/lib/tools.jar
wrapper.java.classpath.2=../lib/wrapper.jar
wrapper.java.classpath.3=../lib/opennms_bootstrap.jar

wrapper.java.library.path.1=../lib

wrapper.java.additional.auto_bits=TRUE

#********************************************************************
# Wrapper Logging Properties
#********************************************************************

wrapper.console.format=PM
wrapper.console.loglevel=WARN
wrapper.logfile=../logs/wrapper.log
wrapper.logfile.format=LPTM
wrapper.logfile.loglevel=INFO

wrapper.logfile.maxsize=0
wrapper.logfile.maxfiles=0

wrapper.syslog.loglevel=NONE

#********************************************************************
# Wrapper Windows Properties
#********************************************************************

wrapper.console.title=OpenNMS

#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************

wrapper.ntservice.name=opennms

wrapper.ntservice.displayname=OpenNMS
wrapper.ntservice.description=Network Management System

wrapper.ntservice.starttype=AUTO_START
wrapper.ntservice.interactive=false

Copy all of the wrapper files into their corresponding OpenNMS directories. If the destination directory doesn't exist (./conf), create it.

Almost there...

Go into the ./bin directory of your OpenNMS installation, and double-click the WrapperInstall.bat file.

Now, you should be able to click on WrapperStart.bat (you did rename it, right?), or go into the Services MMC and start it from there.

2 comments:

  1. Replies
    1. I'm somewhat surprised that it didn't work as-is...but again, I haven't tested it.

      What's it doing, or failing to do?

      Delete