FAQ-Install

From OpenNMS
Jump to: navigation, search

Downloading, Building and/or Installing OpenNMS

Q: Is it possible to build RPMs from the CVS code?

A: Yes.

If you are building the latest ("trunk") code, please see Building OpenNMS for details on making RPMs.

Q: How do I download the OpenNMS software?

A: Binary Packages are available for many operating systems on SourceForge.

However, your best bet is to follow the quick start guide.

Q: How do I install on Debian?

A: Detailed instructions are available at the Debian installation page.

Q: How do I migrate OpenNMS from one server to another?

A: From Gary Banke via e-mail

  • New Box: Install the operating system and all updates. Include:
  • New Box: Download and install Java 5 or Java 6 SDK (or 1.4 if you are running a release prior to 1.2.9).
  • New Box: Copy over all the PostgreSQL configuration files from the old server to the new one. This is everything in: /var/lib/pgsql/data/*.conf
  • New Box: Start PostgreSQL and insure postmaster is running (ps -ef | grep postmaster)
  • New Box: Install OpenNMS
  • Old Box: Stop OpenNMS.
  • Old Box: If running the OpenNMS web app in a separate servlet container such as Tomcat, stop that daemon as well.
  • New Box: Copy all the files in OPENNMS_HOME/etc from the old server.
  • New Box: Copy all the files in OPENNMS_HOME/share/rrd from the old server.
  • Old Box Dump the OpenNMS database to a file:
su - postgres
pg_dumpall > old_data.sql
  • New Box: Copy the old_data.sql file from the old server.
su - postgres
scp oldbox:/var/lib/pgsql/old_data.sql .
  • New Box: Clear the database:
su - postgres
dropdb opennms
  • New Box: Restore the database from the old_data file:
su - postgres
psql -U postgres -f old_data.sql

Q: How do I migrate OpenNMS from one server to another? Another approach

I took the FAQ procedure above and added a "little bit" more of my procedure to use for disaster recovery and testing. You can use this procedure to move a production ONMS 1.3.2 to another "acceptance" (test) server and then do an upgrade to 1.3.9. Use whatever parts will help you. When I name backup files, I put the date at the end of the filename, that's just me. Name them whatever works for you.

  • Assumptions:
  • Assumption that Production ONMS is running and functionally acceptable
  • Assumption that Acceptance ONMS has base RH AS 4 Update5, ONMS prereques (Java JDK 15, Tomcat5.5.20, RRDtool 1.2 w/Perl-rrdtool, PostgreSQL and Curl), and very basic ONMS installed. Basic ONMS with web UI running and functionaly acceptable.

Order of procedure to backup and restore ONMS from Production to Acceptance

  • Production ONMS – stop ONMS and Tomcat
  • Production ONMS – backup postgresql database to a single file
  • Production ONMS – backup /opt/opennms/etc directory and sub’s to a single file
  • Production ONMS – backup /var/opennms/rrd directory and sub’s to a single file
  • Move files from Production ONMS to Acceptance ONMS
  • Acceptance ONMS – stop ONMS and Tomcat
  • Acceptance ONMS – clear out database
  • Acceptance ONMS – restore database from Production ONMS
  • Acceptance ONMS – Uncompress and overwrite /opt/opennms/etc directory and sub’s from Production ONMS
  • Acceptance ONMS - Uncompress and overwrite /var/opennms/rrd directory and sub’s from Production ONMS
  • Acceptance ONMS – reboot server, start tomcat, confirm postgresql/onms started. Check out ONMS functionality.

Detailed procedure:

  • On original production Opennms
    • Stop OpenNMS
    • Stop Tomcat
    • cd /usr/bin
    • sudo -u postgres pg_dumpall >old_data111407
    • gzip old_data111407
    • Move off for storage / disaster recovery
    • Start Tomcat
    • Start Opennms
    • Confirm that Opennms is fine and functional.
  • Now to backup the /opt/opennms/etc directory of Opennms
    • cd /opt/opennms/etc
    • tar -cvpf servername111407.tar *
    • gzip servername111407
    • move off for storage / disaster recovery
    • cd /var/opennms/rrd
    • tar -cvpf rrd111907.tar * File can be very large, mine was 8GB in size.
    • gzip rrd111907.tar
    • Move off for storage / disaster recovery
  • On the Acceptance server
    • Stop ONMS – set chkconfig to NOT start automatically on reboot. I needed to edit files after they have been brought over before starting ONMS
    • Stop tomcat
    • Clear out database
      • cd /usr/bin
      • su - postgres
      • dropdb opennms
      • exit
    • Now to bring over backed up database file from production ONMS, if it is not already there.
    • cd /usr/bin
    • scp productionservername:/opt/opennms/etc/filebackups/old_data111407.gz old_data111407.gz
    • gzip -d old_data111407.gz and make sure it is in /usr/bin
  • To restore database:
    • sudo -u postgres psql –U postgres –f old_data111407 template1
    • Wait and be patient until it ends.
    • Now to uncompress and OVERWRITE the ETC directory and sub’s
    • cd /opt/opennms/etc
    • scp productionservername:/opt/opennms/etc/filebackups/servername111407.tar.gz servername111407.tar.gz
    • gzip –d servername111407.tar.gz
    • tar –xpvf servername111407.tar
  • Now to uncompress and OVERWRITE the /var/opennms/rrd directory and sub’s
  • cd /var/opennms/rrd
  • scp productionservername:/opt/opennms/etc/rrd111907.tar.gz rrd111907.tar.gz
  • gzip –d rrd111907.tar.gz
  • tar –xpvf rrd111907.tar
  • Cleanup:
    • Delete /opt/opennms/etc productionservername112007.tar file
    • Delete /var/opennms/rrd rrd112007.tar file
    • Confirm via chkconfig to NOT start automatically on reboot. We need to edit files after they have been brought over before starting ONMS
    • reboot acceptance server. Probably not nessasary, but I did it anyway.
    • Start postgresql if not automatically started
    • Start tomcat if not automatically started
    • Before starting ONMS, edit notificatations file so no alarms go out. Just in case.
    • Check your javamail-configuration.properties file for proper settings to send mail out.
  • Start Acceptance OpenNMS
  • Ran the vacuum command to clean up database.
  • Sudo –u postgres vacuumdb –v opennms

Q: /etc/rc.d/init.d/opennms start /etc/rc.d/init.d/opennms: OpenNMS not configured. /opt/OpenNMS/etc/configured does not exist. Can someone tell me what's wrong with me ?

A: You need to run the installer — see the quick start guide for details.

Q: How do I convert an rrdtool rrd to a jrobin rrd?

A: The jrobin distribution includes code to convert rrdtool rrds to jrobin rrds. You'll need the convertor class library (currently convertor-1.4.0.jar) which is not included in the OpenNMS distribution.

  1. Download jrobin from sourceforge
  2. Compile jrobin. The default target in jrobin-1.4.0/ant/build.xml will compile the classes and build the jar that you need, so all you need to do is execute ant in that directory.
  3. run the convertor on your file:
[root@ws256 jrobin-1.4.0]# java -classpath ./lib/convertor-1.4.0.jar \
org.jrobin.convertor.Convertor /usr/bin/rrdtool \
/opt/OpenNMS/share/rrd/snmp/1/sCpuRawKernel.rrd
Converting RRDTool files to JRobin native format
Converted files will be placed in the same directory, with .jrb suffix appended
==========================================
sCpuRawKernel.rrd [OK, 1.551]
Conversion finished, 1 files ok, 0 files bad
Time elapsed: 0:02

A: If you don't want to download and compile jrobin, you can write your own program to convert files.

  1. Create a text file named JRobinRestore.java, containing the following:
    import org.jrobin.core.*;
    import org.jrobin.graph.*;
    import java.io.*;
    import java.awt.*;
    
    public class JRobinRestore {
        public static void main(String[] args) throws RrdException, IOException {
            if(args.length != 2) {
                    System.out.println("Usage: java JRobinRestore file.jrb file.xml");
                    System.exit(0);
            }
            RrdDb rrdDb = new RrdDb(args[0],args[1]);
        }
    }
    
  2. Compile it with:
     /usr/java/jdk1.5.0_12/bin/javac -classpath /opt/opennms/lib/jrobin-1.5.8.jar JRobinRestore.java
    
  3. And run it with something like:
    java -Djava.awt.headless=true -cp .:/opt/opennms/lib/jrobin-1.5.8.jar JRobinRestore old.xml test.jrb
    


To iterate over a set of files in a folder, something like the following might work:

for file in *.rrd
do
   echo $file
   rrdtool dump $file >${file%.rrd}.xml
   java -Djava.awt.headless=true -cp .:/opt/opennms/lib/jrobin-1.5.8.jar JRobinRestore ${file%.rrd}.jrb ${file%.rrd}.xml
done

If you get an error "Unsupported RRD version (0003)" with the above utility, try this:

  • Create and compile the JRobinRestore.java program as noted above. Place the resultant JRobinRestore.class file in $OPENNMS_HOME/contrib.
  • Save the following shell script to $OPENNMS_HOME/contrib/convert_rrd_to_jrb.sh (edit the variables as necessary to make it work in your environment):
#!/bin/sh

# convert_rrd_to_jrb.sh
#
# Andy Ellsworth 2010-05-06
#
# This script converts a single version 3 RRDTool RRD file to a JRobin RRD file.
#
# Usage:
# convert_rrd_to_jrb.sh /path/to/sourcefile.rrd /path/to/destinationfile.jrb
#

# Location of various required binaries
RRDTOOL=/usr/local/bin/rrdtool
RM=/bin/rm
SED=/bin/sed
GREP=/bin/grep
JAVABINARY=/usr/bin/java

# Location of JRobin jar
JROBINJAR=/opt/opennms/lib/jrobin-1.5.9.jar

# Location of compiled JRobinRestore.class utility
JRRESTOREDIR=/opt/opennms/contrib

# Source/dest files are passed in as arguments
SOURCEFILE=$1
DESTFILE=$2

# Create temp file name based on PID of script
MYPID=$$
TMPFILE=/tmp/${MYPID}_temp.xml

# Dump the source RRD file to a temporary XML file, 
# and filter it through SED to take out the offending version 3 XML chunks
${RRDTOOL} dump ${SOURCEFILE} | ${SED} 's,<version> 0003 </version>,<version> 0001 </version>,' | ${GREP} -v 'params>' | ${GREP} -v '_value>' > ${TMPFILE}

# Use the Java utility JRobinRestore to convert the modified temporary XML file to a JRobin-compatible RRD file
${JAVABINARY} -Djava.awt.headless=true -cp ${JRRESTOREDIR}:${JROBINJAR} JRobinRestore ${DESTFILE} ${TMPFILE}

# Clean up the temp file
${RM} -f ${TMPFILE}
  • Convert your files using:
$OPENNMS_HOME/contrib/convert_rrd_to_jrb.sh /path/to/sourcefile.rrd /path/to/destinationfile.jrb


Q: How do I change all the JRobin RRD file names to use the new default, ".jrb", JRobin file name extension?

A: from the top-level RRD directory, run the following shell command:

find . -name '*.rrd' | while read f; do echo mv $f ${f%.rrd}.jrb; mv $f ${f%.rrd}.jrb; done

Versions prior to 1.3.2, the default extension for RRDTool and JRobin RRD files was ".rrd". Now, the default extension for JRobin based files is ".jrb" to help visually identify whether the file is JRobin or RRDTool structure. If you want to change your JRobin file names now to prepare for the default file name extension change in 1.3.2, you also need to make the following change to rrd-configuration.properties file:

org.opennms.rrd.fileExtension=.jrb

With version 1.3.2, this is the default extension as well as JRobin being the default RRD strategy. See the #org.opennms.rrd.strategyClass property setting in the "rrd-configuration.properties" file for more details.