OpenNMS on OpenJDK and Fedora 9

Okay, I started mucking around with OpenJDK on Fedora 9 today, and it turns out it is pretty easy to build OpenNMS against OpenJDK and get it to work. There are some tricks, so I thought I’d document my steps.

On a base Fedora, install the following packages:

yum install subversion gcc postgresql-server postgresql-devel rpm-build
yum install autoconf automake libtool
yum install java-1.6.0-openjdk java-1.6.0-openjdk-devel

Then create a place for your subversion files:

mkdir svn
cd svn

and check out OpenNMS. This is the latest testing branch:

svn co https://opennms.svn.sourceforge.net/svnroot/opennms/opennms/branches/1.6-testing testing
cd testing

Now, one of the big issues is that in a lot of places OpenNMS relies on the “jdk” package, which is what Sun’s RPM called the JDK. Since that package doesn’t exist (yet) in Fedora, edit the .spec file:

vi tools/packages/opennms/opennms.spec

and change:

BuildRequires:          jdk

to

BuildRequires:          java-1.6.0-openjdk

Then build:

export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0
./makerpm.sh

After a long time (maven has to check out a lot of dependencies) you should have a bunch of RPMs in

~/svn/testing/target/rpm/RPMS/noarch

Now in order to run OpenNMS, both jicmp and iplike are required. So in your svn directory:

svn co https://opennms.svn.sourceforge.net/svnroot/opennms/jicmp/trunk jicmp
svn co https://opennms.svn.sourceforge.net/svnroot/opennms/iplike/trunk iplike

Build jicmp:

cd jicmp
m4/autogen.sh
./configure

Now at this point I just did:

make
make install

but this will not create RPMs. To get RPMs to work you’d run

make dist
make rpm

But this will crap out due to there being no “jdk” package. While I hate using “–nodeps” for this experiment I just decided to install jicmp and iplike outside of package management (I could modify the .spec file as above but I’m lazy).

Build iplike:

cd ../iplike/
m4/autogen.sh
./configure
make
make install

Then install OpenNMS:

rpm -Uvh --nodeps opennms-1.5.92-0.9251.snapshot.noarch.rpm
                  opennms-core-1.5.92-0.9251.snapshot.noarch.rpm
                  opennms-webapp-jetty-1.5.92-0.9251.snapshot.noarch.rpm

Now, create the postgresql database:

service postgresql initdb

And then open up permissions

vi /var/lib/pgsql/data/pg_hba.conf

and set

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
# IPv6 local connections:
host    all         all         ::1/128               trust

and start PostgreSQL:

service postgresql start

Then, set the Java version:

/opt/opennms/bin/runjava -s

and run the installer

/opt/opennms/bin/install -dis

Now you should be ready to run OpenNMS, but there are a couple of changes still to be made.

For some reason I got an error in Statsd.

An error occurred while attempting to start the "OpenNMS:Name=Statsd" service
(class org.opennms.netmgt.statsd.jmx.Statsd).  Shutting down and exiting.
javax.management.RuntimeMBeanException: org.springframework.beans.PropertyBatchUpdateException;
nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.TypeMismatchException:
Failed to convert property value of type [java.lang.String] to
required type [org.opennms.netmgt.statsd.RelativeTime] for property 'relativeTime';
nested exception is java.lang.IllegalArgumentException: Unsupported value: YESTERDAY at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrow(DefaultMBeanServerInterceptor.java:877)

This could be an OpenJDK issue or just a testing issue, so I disabled that daemon for now:

vi /opt/opennms/etc/service-configuration.xml

and comment out:

<!--
        <service>
                <name>OpenNMS:Name=Statsd</name>
                <class-name>org.opennms.netmgt.statsd.jmx.Statsd</class-name>
                <invoke at="start" pass="0" method="init"/>
                <invoke at="start" pass="1" method="start"/>
                <invoke at="status" pass="0" method="status"/>
                <invoke at="stop" pass="0" method="stop"/>
        </service>
-->

Now OpenNMS will start, but the webapp will be disabled because of a JVM check. To override this:

vi /opt/opennms/etc/opennms.properties

and set

opennms.skipjvmcheck=true

Then just start OpenNMS:

service opennms start

Go to the webapp and set up a discovery range and you’re good to go.

One weird thing is that I don’t think OpenJDK uses the same fonts as Sun’s JDK, so the graphs look a little funky:

Very steampunk.

OpenNMS 1.1.2 for Debian unstable

Ok, I know they are way late in coming, but Debian unstable packages for OpenNMS 1.1.2 are now available for your apt-get upgrade/install ‘ing pleasure.

Detailed installation instructions can be found here, but in a nutshell you just need to:

  • Meet the java dependency by installing one of j2sdk1.4 or java-virtual-machine or java2-runtime
  • Add the OpenNMS repository to sources.list, (deb http://debian.opennms.org/ debian/opennms unstable)
  • apt-get update ; apt-get install opennms

<lame-excuse>
Due to much “brokenness” between OpenNMS and Sid at the time of the 1.1.2 release, I opted to hold off on building any 1.1.2 packages for Debian unstable and concentrate my efforts on the Woody packages. Afterwards, and with the impending release of 1.1.3, skipping 1.1.2 and waiting for the new release sounded like a Good Idea(tm), I have since learned that it is not wise to count unhatched chickens.

My apologies to the Debian user-base, and I promise from here-on-out that I will try to be more timely. 😉
</lame-excuse>

Tomcat and 1.1.1

Okay, seems there is an issue with install.pl and the RPMs for 1.1.1. After installing OpenNMS, edit /opt/OpenNMS/bin/install.pl and change line 121 to read:

$TOMCAT  = 1 if ($arg eq "t");

Then run:
$OPENNMS_HOME/bin/install.pl -q $OPENNMS_HOME/etc/create.sql

Sorry about that.