How to Setup Network Monitoring with OpenNMS on Ubuntu 16.04

February 1, 2017 | By in OPEN SOURCE TOOLS
| Reply More

OpenNMS is a carrier-grade, highly integrated, open source platform designed for building network monitoring solutions. It has the capability to discover and monitor the nodes automatically in a network. Also you can monitor a service by assigning it to Open-NMS.  It can do both automated and directed discovery too. Three main functional areas of it are service monitoring, data collection and event management and notifications. This article explains how to install and configure openNMS opensource monitoring software on ubuntu 16.04 server.

1. Setup Domain name (Optional)

Configure FQDN for your host by adding proper entry for host and domain name in /etc/hosts & /etc/hostname

root@demohost:~# cat /etc/hosts
127.0.0.1 localhost
172.31.24.18 demohost.com demohost

root@demohost:~# cat /etc/hostname
demohost

Restart networking

root@demohost:~# service networking restart

Now check the FQDN of your host

root@demohost:~# hostname
demohost
root@demohost:~# hostname -f
demohost.com

2. Install JAVA

Starting with release 16, Open-nms requires Java 8. To install Oracle JDK, execute the following commands in the terminal.

# Install the add-apt-repository program
root@demohost:~# sudo apt-get install software-properties-common

# Add the private package archive webupd8team/java
root@demohost:~#  sudo add-apt-repository ppa:webupd8team/java
---------------
---------------
gpg: keyring `/tmp/tmpzab7sg5w/secring.gpg' created
gpg: keyring `/tmp/tmpzab7sg5w/pubring.gpg' created
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpzab7sg5w/trustdb.gpg: trustdb created
gpg: key EEA14886: public key "Launchpad VLC" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK

# Update apt database
root@demohost:~# sudo apt-get update

# install Oracle Java8
root@demohost:~# sudo apt-get install oracle-java8-installer

# Setup Oracle Java8 to be the default Java VM
root@demohost:~# sudo apt-get install oracle-java8-set-default

# Check the version of JAVA
root@demohost:~# java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

3. Install PostgreSQL

Install PostgreSQL before installing Open-nms and configure few settings to make sure PostgreSQL is working properly. Use apt-get to install postgreSQL. Next change the password for user postgres and quit/exit postgres shell.

root@demohost:~# sudo apt-get install postgresql postgresql-contrib

root@demohost:~# su - postgres
postgres@demohost:~$ psql
psql (9.5.5)
Type "help" for help.

postgres=#  \password postgres
Enter new password:
Enter it again:
postgres=# \q

postgres@demohost:~$ exit

PostgreSQL only allows to connect if someone is logged in to the local account name that matches the PostgreSQL user. But Open-nms runs as root and hence it cannot connect as a "postgres" or "opennms" user. To do it, edit postgresql database’s pg_hba.conf file and change the following lines last word to trust.

root@demohost:~# vi /etc/postgresql/9.5/main/pg_hba.conf

------------------------------------------------
------------------------------------------------
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
-------------------------------------------------
-------------------------------------------------

Restart PostgreSQL service

root@demohost:~# service postgresql restart

Now, create a database by the name opennms.

root@demohost:~#  su - postgres -c "createdb -U postgres opennms"

4. Install OpenNMS repository

Add Opennms repository information to apt database and get the key.

root@demohost:~# vi /etc/apt/sources.list.d/opennms.list
deb http://debian.opennms.org stable main
deb-src http://debian.opennms.org stable main
root@demohost:~# wget -O - http://debian.opennms.org/OPENNMS-GPG-KEY | sudo apt-key add -

Update the system and install open-nms using apt-get

root@demohost:~# sudo apt-get update

Now install it. You will be asked to run installer manually, click "Ok" to proceed.

root@demohost:~# sudo apt-get install opennms
------------------
------------------
update-alternatives: using /usr/sbin/install_iplike-95.sh to provide /usr/sbin/install_iplike.sh (install_iplike.sh) in auto mode
update-alternatives: using /usr/lib/postgresql/9.5/lib/iplike.so to provide /usr/share/java/opennms/iplike.so (iplike.so) in auto mode
------------------
Setting up s-nail (14.8.6-1) ...
update-alternatives: using /usr/bin/s-nail to provide /usr/bin/mailx (mailx) in auto mode
Setting up opennms-server (18.0.3-1) ...

*** Installation complete.  You must still run the installer at
*** $OPENNMS_HOME/bin/install to be sure your database is up
*** to date before you start OpenNMS.  See the install guide at
*** http://www.opennms.org/wiki/Installation:Debian and the
*** release notes for details.
-----------------
-----------------

Start Opennms

root@demohost:# /etc/init.d/opennms start

5. Configure firewall

Configure firewall to allow traffic to port no 8980

For UFW users:

root@demohost:~# ufw allow 8980/tcp
Rules updated
Rules updated (v6)
root@demohost:~# ufw reload

For IPTABLE users:

[root@demohost ~]# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8980 -j ACCEPT
[root@demohost ~]# iptables-save > /etc/iptables/rules.v4
[root@demohost ~]# service iptables-persistent restart

6. Access Management Interface

Open your favorite browser and navigate to http://domain-name:8980/opennms/  Provide user-name and password as admin/admin, you will be redirected to the dashboard.

Opennms login page

Click "Admin"-> "Change Password"

Opennms change password

Provide a new password and submit.

Change password

To add a new node for monitoring click Admin->Quick Add Node

Opennms quick add node

Give a name of the requisition.

Opennms node requisition name

Fill up the Basic Attributes and click "Provision" at the bottom of the page.

Opennms provision node

You will get a message about new node being added. Click "Ok"

Success message requisition

Now Goto Info->Nodes and find out the node by its label name. Finally click the label, you will now able to view its status, notification, events etc.

Opennms node info

This way you can add more node/devices/services for monitoring/surveillance.

Conclusion:

We have installed and configured a MySQL node using OpenNMS which is free and open source, with no license fees, software subscriptions or special "enterprise" versions. You can now integrate it with JasperReports to create high level reports from the database and collected performance data. Thanks for reading this tutorial.

Filed Under : MONITORING, OPEN SOURCE TOOLS

Tagged With : ,

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.