Installing OpenNMS Network Monitoring And Management Platform On CentOS 7

Introduction

OpenNMS is a free, Open Source, and world’s first enterprise grade network monitoring system that can be used to monitor tens of thousands of unlimited devices with a single instance. It was started almost 15 years back (1999), and still it is being constantly developed by active community. OpenNMS will discover and monitor the services or nodes automatically in your network, or you can assign a particular service to monitor by OpenNMS. Also, If you want, OpenNMS will do both automated and directed discovery too.

OpenNMS can generate its own events, or receive events from outside sources such as SNMP Traps, syslog or TL/1. Also, it is possible to send custom events to OpenNMS in XML formatted text. OpenNMS will send Email or SMS notifications to the administrators, and has a trouble ticketing API that allows it to have bidirectional communication with many popular trouble ticketing systems like OTRS. You can find the complete list of features here.

Installation

In this tutorial, let us install OpenNMS on CentOS 7 server. Before installing make sure you’ve done the following prerequisites steps.

Update your system:

yum update

Set SELinux to permissive mode:

Edit file /etc/selinux/config,

vi /etc/selinux/config
[...]
SELINUX=permissive
[...]

Set proper FQDN in /etc/hosts file.

vi /etc/hosts

Set your fully qualified domain name as shown below.

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.150   server.unixmen.local    server

Save and close the file. Reboot your system.

Install PostgreSQL:

To install PostgreSQL refer the following link.

Now, allow user access to the database. By default, PostgreSQL only allows you to connect if you are logged in to the local account name that matches the PostgreSQL user. Since OpenNMS runs as root, it cannot connect as a “postgres” or “opennms” user by default, so we have to change the configuration to allow that.

To do so, you will need to edit your database’s pg_hba.conf file.

Edit file /var/lib/pgsql/9.4/data/pg_hba.conf,

vi /var/lib/pgsql/9.4/data/pg_hba.conf

Find the following lines:

local   all         all                               peer
host    all         all         127.0.0.1/32          ident
host    all         all         ::1/128               ident

And, change them to look like the following:

local   all         all                               trust
host    all         all         127.0.0.1/32          trust
host    all         all         ::1/128               trust

Once you have finished making changes, restart the database (as root):

systemctl restart postgresql-9.4

Install JDK:

To install JDK, refer the following link.

Important note: While OpenNMS doesn’t support Java 8 yet, It is strongly recommended to use Java 7. The above link contains the installation instructions for Java 8 only. However, you can use the same procedure to install Java 7.

Install OpenNMS Repository:

Go to the OpenNMS yum repository download page, and download the appropriate repository depending upon your distribution version. As I am using CwntOS 7, I installed OpenNMS repository for CentOS.

rpm -ivh http://yum.opennms.org/repofiles/opennms-repo-stable-rhel7.noarch.rpm

Now, update the repository lists using command:

yum update

Then, install OpenNMS:

yum install opennms

Post Installation

Disable OpenNMS YUM Repository:

You must disable OpenNMS repository if you want to do manual upgrade instead of automatic update. If you prefer automatic update, which is easy, you can skip this step.

To do that, edit file /etc/yum.repos.d/opennms-stable-rhel7.repo,

vi /etc/yum.repos.d/opennms-stable-rhel7.repo

Find the line enabled=1, and change it to enabled=0 inside each [opennms-*] section.

enabled=0

If you can find that line, add it. Or siply remove the opennms-stable-rhel7.repo file. Save and close the file.

Update the repository list using command:

yum update

Configure Java:

Then, you need to tell OpenNMS which Java you want it to use. If you installed the recommended Sun/Oracle JDK, all you should need to do is point it at /usr/java/latest:

/opt/opennms/bin/runjava -S /usr/java/latest/bin/java

Sample output:

 runjava: checking specified JRE: "/usr/java/latest/bin/java"...
 runjava: specified JRE is good.
 runjava: value of "/usr/java/latest/bin/java" stored in configuration file

Create Database for OpenNMS:

/opt/opennms/bin/install -dis

Sample output:

 ==============================================================================
 OpenNMS Installer
 ==============================================================================

 Configures PostgreSQL tables, users, and other miscellaneous settings.

 DEBUG: Platform is IPv6 ready: true
 - searching for libjicmp.so:
 - trying to load /usr/lib64/libjicmp.so: OK
 - searching for libjicmp6.so:
 - trying to load /usr/lib64/libjicmp6.so: OK
 - searching for libjrrd.so:
 - trying to load /usr/lib64/libjrrd.so: NO
 - trying to load /usr/lib64/libjrrd.so: NO
 - trying to load /libjrrd.so: NO
 - trying to load /opt/opennms/lib/libjrrd.so: NO
 - trying to load /opt/opennms/lib/linux64/libjrrd.so: NO
 - trying to load /usr/java/packages/lib/amd64/libjrrd.so: NO
 - trying to load /usr/lib64/libjrrd.so: NO
 - trying to load /lib64/libjrrd.so: NO
 - trying to load /lib/libjrrd.so: NO
 
 [...]
 
 Disabling Linkd (to promote EnhancedLinkd)
 Disabling service OpenNMS:Name=Correlator because it is not on the default list of enabled services
 Disabling service OpenNMS:Name=Tl1d because it is not on the default list of enabled services
 Disabling service OpenNMS:Name=Syslogd because it is not on the default list of enabled services
 Disabling service OpenNMS:Name=Xmlrpcd because it is not on the default list of enabled services
 Disabling service OpenNMS:Name=XmlrpcProvisioner because it is not on the default list of enabled services
 Disabling service OpenNMS:Name=AsteriskGateway because it is not on the default list of enabled services
 Disabling service OpenNMS:Name=AccessPointMonitor because it is not on the default list of enabled services
 - Saving the execution state
 - Running post-execution phase
 Removing backup /opt/opennms/etc/service-configuration.xml.zip

 Finished in 0 seconds

 Upgrade completed successfully!

Here,

  • -d – to update the database.
  • -i – to insert any default data that belongs in the database.
  • -s – to create or update the stored procedures OpenNMS uses for certain kinds of data access.

Configure IPLIKE:

OpenNMS uses a PostgreSQL stored procedure called “IPLIKE” which provides an API for easily performing complicated IP address queries. It is optional, but it is recommended for performance reasons.

To install iplike, enter the following command:

yum install iplike

Firewall configuration:

Allow OpenNMS management interface port 8980 through firewall or router to access the management web interface from the remote systems.

To do that, enter the following commands from the Terminal:

firewall-cmd --permanent --add-port=8980/tcp
firewall-cmd --reload

Finally, start OpenNMS service using command:

systemctl start opennms
systemctl enable opennms

Log in To OpenNMS Management Interface

Open up your browser, and point it to http://ip-address:8980/opennms. The following screen should appear. Enter the username and password. The default username and password is admin/admin.

OpenNMS Web Console - Mozilla Firefox_001

if you can’t access the web interface, restart your system and check again.

This is how my OpenNMS dashboard looked.

OpenNMS Web Console - Mozilla Firefox_002

it is not safe to leave the admin user password as default. So let us change it to something different and stronger.

To do that, click on the admin user on the top right corner.

Selection_003

Click Change password link, and enter the new password twice. Finally click OK to save changes.

Change Password | OpenNMS Web Console - Mozilla Firefox_004

That’s it. OpenNMS is up and running now. In our next tutorial, let us discuss how to monitor devices/nodes/services etc. Until then, stay happy.

Want to Install OpenNMS on Ubuntu? then check the following link.

Reference