For those who seek help in different areas of software and hardware platform.

How To Set Up Network Monitoring System using Observium on Ubuntu/Debian

This guide will show you how to install and configure Observium on Ubuntu or Debian.

Observium is an open source and light weight network monitoring tool. It allows you to monitor all of the network devices and operating systems in your datacenter. Observium provides a powerful yet simple and easy to use web interface to monitor the health and status of your network devices.






Prerequisites

You will need one Ubuntu 16.04, 18.04 or Debian 9, 10 having sudo non-root user privileges.


Update Ubuntu/Debian

Before you begin with this tutorial, you will need to run update/upgrade on your Ubuntu or Debian:

sudo apt-get update -y
sudo apt-get upgrade -y

When you are done with the above, restart the system to apply all the updates:

After restart, install some of required packages with the below command:

sudo apt-get install snmp fping python-mysqldb rrdtool subversion whois mtr-tiny ipmitool graphviz imagemagick -y

Once all the prerequisites are installed, you can proceed to the next step.


Install LAMP

You will need to install following required packages to run Observium on your Ubuntu or Debian:

sudo apt-get install apache2 libapache2-mod-php7.0 -y

Once installation complete, start Apache and make it persistent on reboot using the below command:

sudo systemctl start apache2
sudo systemctl enable apache2

Next, install PHP version 7 and other important libraries with below command:

sudo apt-get install php7.0 php7.0-cli php7.0-mysql php7.0-mysqli php7.0-gd php7.0-mcrypt php7.0-json php-pear -y

Once PHP 7 and all the required libraries are installed, run the following command to install MariaDB server:

sudo apt-get install mariadb-server -y

Next, start MariaDB and make it persistent on reboot with below command:

sudo systemctl start mysql
sudo systemctl enable mysql


Configure MariaDB

You will need to secure your MariaDB installation with below script:

sudo mysql_secure_installation

Answer all the questions as follows:

set root password? [Y/n] n
    Remove anonymous users? [Y/n] y
    Disallow root login remotely? [Y/n] y
    Remove test database and access to it? [Y/n] y
    Reload privilege tables now? [Y/n] y

Once the MariaDB is secured, you will need to create a database and a user for Observium.

First, log in to the MySQL shell with the following command:

sudo mysql -u root -p

Enter your root password, then create a database for Observium with the following command:

MariaDB [(none)]>CREATE DATABASE obmdb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

Next, create a user for Observium and grant all privileges to the Observium database with the following command:

MariaDB [(none)]>GRANT ALL PRIVILEGES ON obmdb.* TO 'obmadm'@'localhost' IDENTIFIED BY 'password';

Next, flush the privileges with the following command:

MariaDB [(none)]>FLUSH PRIVILEGES;

Finally, exit from the MySQL shell with the following command:

MariaDB [(none)]>\q


Download Observium

Observium is available in two editions Open Source and Subscription, Open Source Edition is freely available for download with less features and few security fixes, while Subscription Edition is comes with additional features and hardware support. You can download the Open Source version of the Observium from their official website with the following command:

wget http://www.observium.org/observium-community-latest.tar.gz

After downloading, extract the downloaded archive with the following command:

tar -xvzf observium-community-latest.tar.gz

Next, copy the extracted directory to the Apache web root directory:

sudo cp -ar observium /var/www/html/

Next, rename the sample configuration file and make some changes:

cd /var/www/html/observium
sudo cp config.php.default config.php
sudo nano config.php

Change the file as shown below:

    // Database config ---  This MUST be configured
    $config['db_extension'] = 'mysqli';
    $config['db_host']      = 'localhost';
    $config['db_user']      = 'obmadm';
    $config['db_pass']      = 'password';
    $config['db_name']      = 'obmdb';

Save the file, then setup the default schema for the MySQL Database with the following command:

sudo ./discovery.php -u

If everything is fine you should see the following output:

  ___   _                              _
 / _ \ | |__   ___   ___  _ __ __   __(_) _   _  _ __ ___
| | | || '_ \ / __| / _ \| '__|\ \ / /| || | | || '_ ` _ \
| |_| || |_) |\__ \|  __/| |    \ V / | || |_| || | | | | |
 \___/ |_.__/ |___/ \___||_|     \_/  |_| \__,_||_| |_| |_|
                         Observium Community Edition 17.9.0
                                   http://www.observium.org

Install initial database schema ... done.
-- Updating database/file schema
310 -> 311 # (db) . Done (0s).
311 -> 312 # (db) .... Done (0s).
312 -> 313 # (db)  Done (0s).
313 -> 314 # (db)  Done (0s).
314 -> 315 # (php) . Done (0s).
315 -> 316 # (db) . Done (0s).
316 -> 317 # (db) .. Done (0s).
317 -> 318 # (db) . Done (0s).
318 -> 319 # (db) ....... Done (2s).
319 -> 320 # (db) . Done (0s).
320 -> 321 # (db) . Done (0s).
321 -> 322 # (db) . Done (0s).
322 -> 323 # (db) ... Done (1s).
323 -> 324 # (db) ... Done (0s).
324 -> 325 # (db) .... Done (1s).
325 -> 326 # (db) . Done (0s).
326 -> 327 # (db) . Done (0s).
327 -> 328 # (db) . Done (0s).
328 -> 329 # (db) . Done (0s).
329 -> 330 # (db) . Done (0s).
330 -> 331 # (db) . Done (0s).
331 -> 332 # (db) ... Done (1s).
332 -> 333 # (php)  Done (0s).
333 -> 334 # (db) . Done (0s).
334 -> 335 # (php)  Done (0s).
335 -> 336 # (db) . Done (0s).
336 -> 337 # (db) . Done (1s).
337 -> 338 # (db) . Done (0s).
338 -> 339 # (db) ... Done (0s).
339 -> 340 # (db) ... Done (0s).
340 -> 341 # (db) ........ Done (1s).
341 -> 342 # (db) ............... Done (0s).
342 -> 343 # (db) ... Done (0s).
343 -> 344 # (db) .... Done (1s).
344 -> 345 # (db) .. Done (0s).
345 -> 346 # (db) . Done (0s).
346 -> 347 # (db) . Done (0s).
347 -> 348 # (db) F Done (0s, 1 errors).
348 -> 349 # (db) .. Done (0s).
349 -> 350 # (php)  Done (0s).
350 -> 351 # (db) ..... Done (1s).
351 -> 352 # (db) .. Done (0s).
-- Done.

Next, you will need to create a directory to store RRDs and Logs:

sudo mkdir rrd logs

Change the ownership of the observium directory with the following command:

sudo chown -R www-data:www-data /var/www/html/observium

Next, you will need to create an Apache virtual host file for Observium. To do so, create a new configuration file observium.conf:

sudo nano /etc/apache2/sites-available/observium.conf

Add the following lines:

   
     ServerAdmin admin@example.com
     ServerName example.com
     DocumentRoot /var/www/html/observium
   
     Options FollowSymLinks
     AllowOverride None
   
   
     Options Indexes FollowSymLinks MultiViews
     AllowOverride All
     Require all granted
   
     ErrorLog  /var/log/apache2/error.log
     LogLevel warn
     CustomLog  /var/log/apache2/access.log combined
     ServerSignature On
   

Save the file, then enable the observium virtual host file and disable default virtual host file with the following command:

sudo a2ensite observium
sudo a2dissite 000-default

Next, you will also need to enable Apache rewrite module and PHP mcrypt module. You can do this by running the following command:

sudo a2enmod rewrite
sudo phpenmod mcrypt

Finally, restart apache web server with the following command:

sudo systemctl restart apache2

Next, create your first admin user with the following command:

sudo /var/www/html/observium/adduser.php admin yourpassword 10

If everything went fine, you should see the following output:

    Observium CE 0.17.7.8697
    Add User

    User admin added successfully. 


Access Observium Web Interface

Before accessing Observium, you will need to allow port 80 through the UFW firewall. By default, UFW is not installed on Debian 9, so you will need to install it first.

sudo apt-get install ufw -y

Once the UFW is installed, enable UFW with the following command:

sudo ufw enable

Next, allow port 80 through UFW firewall with the following command:

sudo ufw allow 80

Once the firewall is configured, open your web browser and type the URL http://server_hostname.example.com or http://server_ip_address you should see the following page:


Here, enter your admin username and password, then click on the Login button you should see the Observium default dashboard as below:


Next, you will need to create a cron job for polling and discovering devices from network. You can do this by creating a cron file inside /etc/cron.d directory:

sudo nano /etc/cron.d/observium

Add the following lines:

# Run a complete discovery of all devices once every 2 hours
25  */2   * * *   root    /var/www/html/observium/discovery.php -h all >> /dev/null 2>&1

# Run automated discovery of newly added devices every 10 minutes
*/10 *     * * *   root    /var/www/html/observium/discovery.php -h new >> /dev/null 2>&1

# Run multithreaded poller wrapper every 10 minutes
*/10 *     * * *   root    /var/www/html/observium/poller-wrapper.py 4 >> /dev/null 2>&1

# Run housekeeping script daily for syslog, eventlog and alert log
10 2 * * * root /var/www/html/observium/housekeeping.php -ysel >> /dev/null 2>&1

# Run housekeeping script daily for rrds, ports, orphaned entries in the database and performance data
10 1 * * * root /var/www/html/observium/housekeeping.php -yrptb >> /dev/null 2>&1

Save and close the file when you are finished, then restart cron service to apply this changes:

sudo systemctl restart cron




Conclusion

Now you can proceed adding your network devices such as switches, firewall, routers, Windows and Linux servers to collect the status and health report.
Share:

Video Tutorials