Configure OpenNMS Step By Step Submitted by saad khan on Fri, 2006-07-28 14:54. :: Monitoring OpenNMS Introduction OpenNMS is an opensource enterprise network management tool. It helps network administrators to monitor critical services on remote machines and collects the information of remote nodes by using SNMP. OpenNMS has a very active community, where you can register yourself to discuss your problems. Normally OpenNMS installation and configuration takes time, but I have tried to cover the installation and configuration part in a few steps. OpenNMS provides the following features. ICMP Auto Discovery SNMP Capability Checking ICMP polling for interface availability HTTP, SMTP, DNS and FTP polling for service availability Fully distributed client server architecture JAVA Real-time console to allow moment-to-moment status of the network XML using XSL style web access and reporting Business View partitioning of the network using policies and rules Graphical rule builder to allow graphical drag/drag relationships to be built JAVA configuration panels Redundant and overlapping pollers and master station Repeating and One-time calendaring for scheduled downtime The source code of OpenNMS is available for download from sourceforge.net. A production release (stable) and a development release (unstable), I have used 1.2.7 stable release in this howto. I have tested this configuration with Redhat/Fedora, Suse, Slackware, Debian and it works smoothly. I am assuming that readers already have Linux background. You can use the following configuration for other distributions too. Before you start OpenNMS installation, you need to install following packages: jdk1.5* tomcat 4.* postgres 8.* rrdtool1.2* jdk1.5* Download jdk1.5* from www.sun.com and unpack it with following command. ./jdk1.5*.bin After unpacking, you will have a directory named jdk1.5*, Rename it to java directory and move it to /usr/lib. Examples mv jdk.* java mv java /usr/lib/ Setup Environment variable for java home. Insert the following entries in /etc/profile. JAVA_HOME="/usr/lib/java" export JAVA_HOME save the file then exit and run the command to read /etc/profile. source /etc/profile Tomcat 4.* Download tomcat 4.* from tomcat.apache.org and extract it from archive zip/tar.gz. Rename tomcat.* to tomcat and then move it to /opt folder. mv tomcat.* /opt/tomcat Setup Environment variable for tomcat home. Insert the following entries in /etc/profile. CATALINA_HOME="/opt/tomcat" export CATALINA_HOME Save the file then exit and run the command to read /etc/profile. source /etc/profile Postgres 8.* Download stable version of Postgresql from www.postgresql.org and extract it from archives bz2/tar.gz. go into postgresql* directory and run the following script. ./configure --prefix=/opt/pgsql In our installion, /opt/pgsql is the destination directory for postgresql installation. Now start the installation of postgresql with following command. make install After this process, add a user to manage postgresql and define home directory /opt/pqsql/ for this user. adduser postgres You need to create a directory called "data" into /opt/pqsql, where you can store your data and assign it following permission. mkdir /opt/pgsql/data chown postgres /opt/pgsql/data Switch user to postgres su - postgres Now you need to initialize your postgres databases. $bin/initdb -D data/ Setup Environment variable for postgres home. Insert the following entries in /etc/profile. POSTGRES_HOME="/opt/pgsql" export POSTGRES_HOME Save the file then exit and run the command to read /etc/profile. source /etc/profile Rrdtool-1.2* You can download rrdtool from http://rrdtool.paracoda.com/download.en.html untar the files from tarball. And run the following commands. tar xzvf rrdtool1.2*.tar.gz cd rrdtool* ./configure --prefix=/usr/local/rrdtool ; make ; make install When you run configure script, it may ask to install cgilib, if you don't have cgilib on your system, download cgilib from sourceforge.net and install it. Then run the above commands again to install rrdtool. Setup Environment variable for rrdtool home. Insert the following entries in /etc/profile. RRDTOOL_HOME="/usr/local/rrdtool" export RRDTOOL_HOME Save the file then exit and run the command to read /etc/profile. source /etc/profile OpenNMS-1.2.* Now we will install OpenNMS. Download OpenNMS 1.2.* source code from www.opennms.org (i had used 1.2.7 version during configuration). untar it. tar xzvf opennms-source-1.2.*.tar.gz Rename opennms-1.2.* to opennms directory. mv opennms-1.2.* opennms Go into OpenNMS directory and create a file named build.properties. Add following lines in the build.properties file. install.dir=/opt/opennms build.postgresql.include.dir=/opt/pgsql/include/server Save the file and exit Now you can run following command to install opennms sh build.sh install If installation process returns errors and asks to define the path for rrdtool, then you will have to put following entries in the build.properties file. build.rrdtool.include.dir="add here include directory path for rrdtool without double quotes" build.rrdtool.lib.dir="add here lib directory path for rrdtool without double quotes" build.rrdtool.bin="add here binary path for rrdtool without double quotes" Save the file and exit Run the following command again sh build.sh install It will take time to complete installation process. Setup Environment variable for OpenNMS home. Insert the following entries in /etc/profile. OPENNMS_HOME="/opt/opennms" export OPENNMS_HOME Save the file then exit and run the command to read /etc/profile source /etc/profile Checking perl modules Go into /opt/opennms/bin directory and run all *.pl scripts with perl command to check for the missing modules. if any of these *.pl scripts returns a error for missing module then install its module with cpan. Configure OpenNMS Run the following commands to configure OpenNMS. $OPENNMS_HOME/bin/runjava -s #This command will search jre $OPENNMS_HOME/bin/runjava -S "path to JRE without quotes" #Define your path for jre Now run following command to create OpenNMS database and make sure postgres service is running. $OPENNMS_HOME/bin/install -disU #This command will setup postgresql database for opennms $OPENNMS_HOME/bin/install -y -w $CATALINA_HOME/webapps -W \ $CATALINA_HOME/server/lib #This command will setup the web application Configure auto discovery Go into following directory, open the discovery-configuration.xml with vi and add your ip range in begin and end tags. cd $OPENNMS_HOME/etc/ vi discovery-configuration.xml Save the file and exit Final Steps Run the following commands to start services. sudo -u postgres /opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l /opt/pgsql/logfile\ start $CATALINA_HOME/bin/startup.sh $OPENNMS_HOME/bin/opennms start Now you can login to main page of OpenNMS in your browser. http://machine-ip:8080/opennms Use user name "admin" and password "admin" to logging to main page. If i have missed anything to add then let me know Written by Saad Khan