Install Observium on Ubuntu 20.04

Updated on November 21, 2023
Install Observium on Ubuntu 20.04 header image

Introduction

Observium is a free network monitoring and management platform that supports various operating systems, devices, and other platforms. Its auto-discovering feature collects data from network devices using SNMP (Simple Network Management Protocol) and stores it in a MySQL database. Being a PHP-based platform, it offers an easy-to-use web interface to allow you to monitor the network devices. Some supported platforms and devices are Linux, Cisco, FreeBSD, Windows, Juniper, Brocade, Netscaler, and NetApp. In this article, you will learn how to install Observium on Ubuntu 20.04 server.

Prerequisites

1. Install Required Packages

Update the system packages.

$ sudo apt update

Install all the required packages needed to run Observium.

$ sudo apt install libapache2-mod-php7.4 php7.4-cli php7.4-mysql php7.4-gd php7.4-json php7.4-bcmath \
php7.4-mbstring php7.4-opcache php7.4-curl php-apcu php-pear snmp fping rrdtool whois \
mysql-server mysql-client subversion mtr-tiny ipmitool graphviz imagemagick apache2 \
python3-mysqldb python3-pymysql python-is-python3 -y

2. Configure MySQL Database

Log in to the MySQL shell. Then, at the password prompt, press Enter to continue.

$ sudo mysql -u root -p

Create a database named observium.

CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

Create a user named observium. Modify the StrongPassword value with your secure password.

CREATE USER 'observium'@'localhost' identified by 'StrongPassword';

Grant all database privileges to the user.

GRANT ALL ON observium.* TO 'observium'@'localhost';

Reload the changes.

FLUSH PRIVILEGES;

Exit MySQL shell.

\q

3. Install and Configure Observium

Create a directory /opt/observium for Observium.

$ sudo mkdir -p /opt/observium

Add Observium system user.

$ sudo useradd -r -M -d /opt/observium observium

Add the user to group www-data.

$ sudo usermod -a -G observium www-data

Change the permissions of the directory.

$ sudo chown -R observium:observium /opt/observium/

$ sudo chmod -R 775 /opt/observium/

Navigate to /opt.

$ cd /opt

Download the latest Observium Community Edition installation files.

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

Unpack the downloaded files.

$ sudo tar zxvf observium-community-latest.tar.gz

Navigate into the new install directory.

$ cd observium

Copy the default configuration file.

$ sudo cp config.php.default config.php

Edit the file for your system.

$ sudo nano config.php

Modify the file as shown bellow:

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

Create rrd and logs directory.

$ sudo mkdir /opt/observium/{rrd,logs}

Insert the default MySQL database schema.

$ sudo ./discovery.php -u

4. Configure Apache

Edit the default Apache configuration file.

$ sudo nano /etc/apache2/sites-available/000-default.conf

The final content should be similar to the one below.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /opt/observium/html

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

    <Directory /opt/observium/html/>
        DirectoryIndex index.php
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog  ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog  ${APACHE_LOG_DIR}/access.log combined
    ServerSignature On
</VirtualHost>

Disable mpm_event module.

$ sudo a2dismod mpm_event

Enable mpm_prefork module.

$ sudo a2enmod mpm_prefork

Enable mod_rewrite.

$ sudo a2enmod rewrite

Restart the Apache service.

$ sudo apache2ctl restart

5. Configure Admin Account

Add and initial user with level of 10 for admin. Modify the AdminPassword value with your own secure password.

$ sudo ./adduser.php admin AdminPassword 10

Create a new file /etc/cron.d/observium to add cron jobs.

$ sudo nano /etc/cron.d/observium

Add the following contents:

# Run a complete discovery of all devices once every 6 hours
33  */6   * * *   root    /opt/observium/discovery.php -h all >> /dev/null 2>&1

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

# Run multithreaded poller wrapper every 5 minutes
*/5 *     * * *   root    /opt/observium/poller-wrapper.py >> /dev/null 2>&1

# Run housekeeping script daily for syslog, eventlog and alert log
13 5 * * * root /opt/observium/housekeeping.php -ysel >> /dev/null 2>&1

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

6. Access Observium Web Interface

To access the Observium Web Interface, go to your browser and visit http://Server_IP/. For example:

http://192.0.2.10/

Conclusion

You have successfully installed Observium on your server. You will get a login screen; use admin as your username and AdminPassword as your password. Modify the AdminPassword value with the secure password you entered during setup. You can now access the Dashboard and configure it to begin managing your network.

More Information

To learn more about Observium, go to the official documentation page.