how to install Observium on ubuntu with Nginx

 

Install Observium on Ubuntu 21.04 with Nginx

Observium is an auto-discovering network monitoring tool with low-maintenance and support for Cisco, Juniper, Linux, Windows, HP, Dell, FreeBSD, Brocade, NetApp, Netscaler,Huawei,Ubiquiti,MikroTik and many more.

In this article, I wrote about how to How to Install and Configure LibreNMS on Ubuntu. For the record, LibreNMS is a fork of Observium. Observium focuses on providing a beautiful and powerful yet simple and intuitive interface to the health and status of your network.

Install Observium on Ubuntu 21.04 | 20.04|18.04 LTS with Nginx

Observium is powered by PHP, MariaDB and Nginx/Apache web server. Let’s kick off by ensuring all these dependencies are installed on our Ubuntu 20.04|18.04 system.

Step 1: Install PHP and required modules

Ubuntu 18.04+ has PHP 7.x in its repositories. Install it by running the commands below on your terminal:

sudo apt update

sudo apt -y install wget php php-{pear,cgi,common,curl,mbstring,gd,mysql,bcmath,imap,json,xml,snmp,fpm,zip}

To confirm the php version installed, use the command php -v:

# Ubuntu 20.04

$ php -v

Configure and Start PHP-FPM

Ensure date.timezone is set in php.ini to your preferred time zone:

Edit both files:

sudo nano /etc/php/*/fpm/php.ini

sudo nano /etc/php/*/cli/php.ini

Change date.timezone under [Date] section:

[Date]

; Defines the default timezone used by the date functions

; http://php.net/date.timezone

date.timezone = Asia/Karachi

Restart php fpm:

sudo systemctl restart php*-fpm.service

Step 2: Install Nginx Web Server

For this setup, we will use Nginx as a web server for Observium, install it by running:

#sudo apt remove apache2 -y >> optional

sudo apt -y install nginx

Ensure it is enabled to start on boot:

sudo systemctl enable nginx

sudo systemctl start nginx

 

systemctl status nginx

 

if nginx is not run properly you must change nginx default port 80 to any_resever_port

 

go to

nano /etc/nginx/sites-enabled/default

 

i.e

 

# Default server configuration

#

server {

        listen 7080 default_server;

        listen [::]:7080 default_server;

 

Step 3: Install and configure MariaDB

Install MariaDB Server:

sudo apt install mariadb-server

Once you’re done with the installation, create database and user for Observium.

Observium is not fully compatible with MySQL strict mode, for now, please disable this after mysql is installed.

sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf

Within the [mysqld] section please add:

innodb_file_per_table=1

sql-mode=""

lower_case_table_names=0

Then restart mysql

sudo systemctl restart mariadb

Once database server has been installed and configured, you need to create a database for Observium.

$ sudo mysql -u root

create database observium;

grant all privileges on observium.* to observium@localhost IDENTIFIED by "password";

flush privileges;

quit

Step 4: Download and Install Observium

Add observium system user:

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

Now add this user to web user group www-data

sudo usermod -a -G observium www-data

When done. proceed to install packages required by Observium

sudo apt update

sudo apt install rrdtool whois fping imagemagick graphviz mtr-tiny nmap python3-mysqldb snmp snmpd python3-memcache mtr-tiny acl

Download the latest Observium Community edition and extract it.

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

tar xvf observium-community-latest.tar.gz

Move the resulting folder to the /opt directory:

sudo mv observium /opt

Change to the observium directory and create a config file.

sudo cp /opt/observium/config.php.default /opt/observium/config.php

Edit the file to set database connection:

sudo nano /opt/observium/config.php

Set like below:

// Database config ---  This MUST be configured

$config['db_extension'] = 'mysqli';

$config['db_host']      = 'localhost';

$config['db_user']      = 'observium';

$config['db_pass']      = 'password';

$config['db_name']      = 'observium';

Create rrd and logs directory.

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

Change permission of the directory:

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

sudo chmod -R 775 /opt/observium/

Configure snmpd

Copy snmpd sample file:

sudo cp /opt/observium/snmpd.conf.example /etc/snmp/snmpd.conf

Configure String below in snmpd.conf file.

$ sudo nano /etc/snmp/snmpd.conf

com2sec readonly  default         0bservium

Restart snmpd

sudo systemctl restart snmpd

Verify service status is running:

$ systemctl status snmpd

Step 5: Configure Nginx

Let’s create the VirtualHost definition for Nginx to load Observium web interface.

Create new file

sudo nano /etc/nginx/conf.d/observium.conf

 

you may change the default http 80 to anyone port no

Paste below contents and modify to fit your use.

server {

 listen      80;

 server_name observium.example.com;

 root        /opt/observium/html;

 index       index.php;

 

 charset utf-8;

 gzip on;

 gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;

 location / {

  try_files $uri $uri/ /index.php?$query_string;

 }

 location /api/v0 {

  try_files $uri $uri/ /api_v0.php?$query_string;

 }

 location ~ \.php {

  include fastcgi.conf;

  fastcgi_split_path_info ^(.+\.php)(/.+)$;

  fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; #ubuntu 20.04

  #fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; #ubuntu 18.04

 }

 location ~ /\.ht {

  deny all;

 }

}

Check syntax:

$ sudo nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

if all is okay, restart nginx:

sudo systemctl restart nginx

 

root@observium:~# systemctl status nginx.service

● nginx.service - A high performance web server and a reverse proxy server

     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)

     Active: active (running) since Wed 2021-09-01 21:25:04 PKT; 5s ago

       Docs: man:nginx(8)

    Process: 79695 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

    Process: 79703 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

   Main PID: 79704 (nginx)

      Tasks: 4 (limit: 4634)

     Memory: 4.0M

     CGroup: /system.slice/nginx.service

             ├─79704 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;

             ├─79705 nginx: worker process

             ├─79706 nginx: worker process

             └─79707 nginx: worker process

 

Sep 01 21:25:04 observium systemd[1]: Starting A high performance web server and a reverse proxy server...

Sep 01 21:25:04 observium systemd[1]: Started A high performance web server and a reverse proxy server.

Step 6: Configure Observium on Web UI

Import MySQL scheme :

cd /opt/observium

sudo ./discovery.php -u

Sample output:

$ sudo ./discovery.php -u

 

  ___   _                              _

 / _ \ | |__   ___   ___  _ __ __   __(_) _   _  _ __ ___

| | | || '_ \ / __| / _ \| '__|\ \ / /| || | | || '_ ` _ \

| |_| || |_) |\__ \|  __/| |    \ V / | || |_| || | | | | |

 \___/ |_.__/ |___/ \___||_|     \_/  |_| \__,_||_| |_| |_|

                     Observium Community Edition 20.9.10731

                                  https://www.observium.org

 

Install initial database schema ... done.

-- Updating database/file schema

416 -> 417 # (db) .. Done (0s).

417 -> 418 # (db) . Done (0s).

418 -> 419 # (db) .... Done (0s).

419 -> 420 # (db) .. Done (0s).

420 -> 421 # (db) ... Done (0s).

421 -> 422 # (db) .. Done (0s).

422 -> 423 # (db) ...... Done (0s).

423 -> 424 # (php)  Done (0s).

424 -> 425 # (db) . Done (0s).

425 -> 426 # (db) ............... Done (0s).

426 -> 427 # (db) ... Done (0s).

427 -> 428 # (db) ... Done (1s).

428 -> 429 # (db) ... Done (0s).

429 -> 430 # (db) (WARNING! Required MySQL version 5.6+ or MariaDB 10.0+).... Done (0s).

430 -> 431 # (db) ..... Done (0s).

431 -> 432 # (php)  Done (0s).

432 -> 433 # (db) ......... Done (0s).

433 -> 434 # (db) ... Done (0s).

434 -> 435 # (db) . Done (0s).

-- Done.

Add admin user:

Add a user for accessing the Observium portal. You can add more than one user.

Command syntax:

adduser.php <username> <password> <level 1-10> [email]

User access Levels:

  0 - Disabled (This user disabled)

  1 - Normal User (This user has read access to individual entities)

  5 - Global Read (This user has global read access)

  7 - Global Secure Read (This user has global read access with secured info)

  8 - Global Secure Read / Limited Write (This user has secure global read access with scheduled maintenence read/write.)

  10 - Administrator (This user has full administrative access)

Examples:

$ cd /opt/observium

$ sudo ./adduser.php admin password 10

Observium CE 20.9.10731

Add User

User admin added successfully.

 

10 is the highest level of access

Access Observium Web Interface

Now open your web browser and start the installer:

http://observium.example.com

Use the username and password of the admin user to login.

Cacti Free Networking Monitoring Tool: Cacti Tutorial PlayList:https://www.youtube.com/playlist?list=PL2iPlJTsTrSRcLWPSRi--dF7rN4RyUzWb

 __________________________________

LibreNMS Free Networking Monitoring Tool: LibreNMS Tutorials: https://www.youtube.com/playlist?list=PL2iPlJTsTrSRdSVlok674Bkou0zkrPbgb

__________________________________

CCNP ENCOR (350-401): https://www.youtube.com/playlist?list=PL2iPlJTsTrSTpfE-r7M-NsHON3AcyFNSk

 __________________________________

CCNP Enterprise Free Training: https://www.youtube.com/playlist?list=PL2iPlJTsTrSTWw5DSSXG-kvbVmpAec06J

__________________________________

CCNP ENARSI (300-410): https://www.youtube.com/playlist?list=PL2iPlJTsTrSQx_kwwr0ERU_Cmj_gsJ5Le

 https://ipcorenetworks.blogspot.com/2021/05/ip-core-networks-your-learning-your.html

fb: https://www.facebook.com/ipcorenetworks/

 

Comments

Popular posts from this blog

Installing NFSEN & NFDUMP on Ubuntu and Next integrate with LibreNMS

IP Core Networks | Your Education, Your Choice

How to Install & Integrate Oxidized Into LibreNMS