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.
I think the Statsd error is due to the presence in Fedora 9 of PostgreSQL 8.3, which removed many implicit casts.
I followed the directions closely and got it to compile, I just had a few comments.
1. When you say change:
BuildRequires: jdk
It was:
BuildRequires: %{jdk}
2. Where you said:
export JAVA_HOME=/usr/lib/jvm/java-1.6.0.openjdk-1.6.0.0
It was:
export JAVA_HOME=/usr/lib/jvm/java-1.6.0.openjdk-1.6.0.0/jre
The issue I am having is that it works fine on the local network but not remotely. I have the firewall completely disabled. Could this be because Statsd is disabled.
statsd shouldn’t be a problem (it does topN reports). I’ll fire up the VM and check it out tomorrow to see if I can reproduce the no access from remote computers.
I solved the remote access problem. If you do an: iptables -nvL you will see there is no accept rule for port 80 or 8980. I did a standard install so I don’t know why that would be. To fix enter:
iptables -I INPUT -p tcp –dport 80 -j ACCEPT
iptables -I INPUT -p tcp –dport 8980 -j ACCEPT
I am new to fedora, we mainly use SuSE Enterprise Server 9, but I had too much trouble trying to get this version of opennms to compile there. Do you know what the GUI is to manipulate iptables on fedora.