How to Setup Network Monitoring with OpenNMS on Ubuntu 16.04

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

[email protected]:~# cat /etc/hosts
127.0.0.1 localhost
172.31.24.18 demohost.com demohost

[email protected]:~# cat /etc/hostname
demohost

Restart networking

[email protected]:~# service networking restart

Now check the FQDN of your host

[email protected]:~# hostname
demohost
[email protected]:~# 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
[email protected]:~# sudo apt-get install software-properties-common

# Add the private package archive webupd8team/java
[email protected]:~#  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
[email protected]:~# sudo apt-get update

# install Oracle Java8
[email protected]:~# sudo apt-get install oracle-java8-installer

# Setup Oracle Java8 to be the default Java VM
[email protected]:~# sudo apt-get install oracle-java8-set-default

# Check the version of JAVA
[email protected]:~# 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.

[email protected]:~# sudo apt-get install postgresql postgresql-contrib

[email protected]:~# su - postgres
[email protected]:~$ psql
psql (9.5.5)
Type "help" for help.

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

[email protected]:~$ 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.

[email protected]:~# 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

[email protected]:~# service postgresql restart

Now, create a database by the name opennms.

[email protected]:~#  su - postgres -c "createdb -U postgres opennms"

4. Install OpenNMS repository

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

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

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

[email protected]:~# sudo apt-get update

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

[email protected]:~# 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

[email protected]:# /etc/init.d/opennms start

5. Configure firewall

Configure firewall to allow traffic to port no 8980

For UFW users:

[email protected]:~# ufw allow 8980/tcp
Rules updated
Rules updated (v6)
[email protected]:~# ufw reload

For IPTABLE users:

[[email protected] ~]# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8980 -j ACCEPT
[[email protected] ~]# iptables-save > /etc/iptables/rules.v4
[[email protected] ~]# 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.

Dwijadas Dey 3:20 am

About Dwijadas Dey

Dwijadas Dey is working with GNU/Linux, Open source systems since 2005. Having avid follower of GNU/Linux, He believes in sharing and spreading the open source ideas to the targeted audience. Apart from freelancing he also writes for community. His current interest includes information and network security.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.