OpenNMS a network monitoring system,and is in some ways a competitor to Nagios. Having been a Nagios user for a while now, I was intrigued to see the alternatives were like. I last tried installing OpenNMS many years ago, and struggled installing it on FreeBSD. Now that it’s had a few more years to develop, I wondered if it was any easier to install, as there’s no port for it. Here are the notes I made to get it installed…
The installation environment was a VMWare environment (using VMWare Fusion on an iMac). The virtual machine was given an 8GB disk and 512MB RAM. In retrospect I should have allocated more RAM, as there was a lot of swapping going on during the build process. I installed packages rather than ports, to minimise the amount of disk space used and time taken.
- Install FreeBSD 7.2 (or later in the 7 series – 8 doesn’t have a functioning Java binary yet). I used the amd64 version.
- Ensure that the system can resolve its own name, either in DNS or an entry in the hosts file. OpenNMS will not start without this.
- Install PostgreSQL server.
# pkg_add -r postgresql83-server
This will also install libiconv, gettext and postgresql83-client. We install PostgreSQL 8.3 because 8.4.0 has a bug, and there isn’t a package for 8.4.1 yet.
- Edit /etc/rc.conf and add the line postgresql_enable=”YES”
- Initialise the database.
# /usr/local/etc/rc.d/postgresql initdb
- Start the database.
# /usr/local/etc/rc.d/postgresql start
- Install some packages needed by Java.
# pkg_add -r javavmwrapper# pkg_add -r xtrans# pkg_add -r xproto# pkg_add -r xextproto
- Go to http://www.FreeBSDFoundation.org/downloads/java.shtml and download Diablo Caffee JDK 1.6.0-7 for FreeBSD 7 amd64. Then transfer it to the machine you’re building OpenNMS on.
- Install the Java package.
# pkg_add /usr/local/opennms/diablo-jdk-freebsd7.amd188.8.131.52.07.02.tbz
Agree to the license when prompted. You will get some warnings about version mismatches. These warnings can be safely ignored.
- Install python 2.5. This is a prerequisite package for jicmp, but is not marked as such, so it won’t be automatically installed by pkg_add.
# pkg_add -r python25
- Install jicmp.
# pkg_add -r jicmp
This also installs xcb-proto.
- Fetch the OpenNMS source.
# fetch http://downloads.sourceforge.net/project/opennms/OpenNMS%20Source/stable-1.6.7/opennms-source-1.6.7-1.tar.gz
- Untar the OpenNMS source.
# tar xfz opennms-source-1.6.7-1.tar.gz
- Change to the source directory.
# cd opennms-1.6.7-1/source
- Build OpenNMS, telling it that it will be installed in /usr/local/opennms.
# ./build.sh -Dopennms.home=/usr/local/opennms install assembly:attached
This stage may stop with errors about running out of java heap memory. If this happens, simply re-run the command, the build will commence from the error.
- Create the /usr/local/opennms directory.
# mkdir /usr/local/opennms
- Change to the /usr/local/opennms directory.
# cd /usr/local/opennms
- Untar the OpenNMS package.
# tar xfz opennms-1.6.7-1/source/target/opennms-1.6.7.tar.gz
- Change the permissions on some files that are incorrectly set by the build.
# chmod +x bin/*
# chmod +x contrib/*
# chmod -x contrib/*.README
# chmod -x contrib/opennms.mib
- Run the runjava command.
# /usr/local/opennms/bin/runjava -s
This should find the java binaries you installed earlier.
- FreeBSD uses pgsql as the database user, rather than postgres, so edit the file /usr/local/opennms/etc/opennms-datasources.xml and change the database user from postgres to pgsql.
- Set up the database.
# /usr/local/opennms/bin/install -dis
- Start OpenNMS.
# /usr/local/opennms/bin/opennms start
If you want the additional features provided by jrrd, then you can install it by running pkg_add -r jrrd. Note that this installs a lot of other packages (renderproto, kbproto, font-util, encodings, expat, perl, gio-fam-backend, pango, rrdtool, bitstream-vera, cairo, font-bh-ttf, font-misc-ethiopic, font-misc-meltho, font-util, fontconfig, freetype2, gamin, glib, libX11, libXau, libXdmcp, libXft, libXrender, libfontenc, libpthread-stubs, libxcb, libxml2, mkfontdir, mkfontscale, pcre, pixman, pkg-config, png, xcb-util, xorg-fonts-truetype and xtrans).