Install Observium on Ubuntu 18.04
(Step-by-Step Guide)
Observium: A Complete Network Management and Monitoring System. It is a PHP/MySQL driven Network Observation and Monitoring application, that supports a wide range of operating systems/hardware platforms including, Linux, Windows, FreeBSD, Cisco, HP, Dell, NetApp and more. Observium is powered by PHP, MariaDB and Nginx /Apache webserver.
Let’s kick off by ensuring all these dependencies are installed on our Ubuntu 18.04 system.
Step 1: Install PHP and required modules
Ubuntu 18.04 has PHP 7.2 in its repositories. Install it by running the commands below on your terminal:
- sudo apt-get -y install wget php php-pear php-cgi php-common php-curl \
php-mbstring php-gd php-mysql php-gettext php-bcmath \
php-imap php-json php-xml php-snmp php-fpm php-zip
To confirm the php version installed, use the command php -v
- php -v
PHP 7.2.8 (cli) (built: Jul 17 2018 09:50:46) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Configure and Start PHP-FPM
Ensure date.timezone is set in php.ini to your preferred time zone:
Edit both files:
- sudo vim /etc/php/7.2/fpm/php.ini
- sudo vim /etc/php/7.2/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 = Africa/Nairobi
Restart php fpm:
- sudo systemctl restart php7.2-fpm.service
Step 2: Install Nginx Web Server
(NginX is a web server, which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache)
For this setup, we will use Nginx as a web server for Observium, install it by running:
- sudo apt-get install nginx
Ensure it is enabled to start on boot:
- sudo systemctl enable nginx
Step 3: Install and configure MariaDB.
Follow the guide below to Installing MariaDB on Ubuntu 18.04
To install MariaDB on Ubuntu 18.04, follow these steps:
- Update packages index.
- sudo apt update
- Once the packages list is updated, install MariaDB by issuing the following command
- sudo apt install mariadb-server
- The MariaDB service will start automatically. You can verify it by typing:
- sudo systemctl status mariadb
OUTPUT
mariadb.service – MariaDB database serverLoaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor presetActive: active (running) since Sun 2020-05-12 11:31:31 UTC; 38s agoMain PID: 13932 (mysqld)Status: “Taking your SQL requests now…” Tasks: 27 (limit: 507)CGroup: /system.slice/mariadb.service └─13932 /usr/sbin/mysqld
You can also check the MariaDB version with:
- mysql –V
OUTPUT
mysql Ver 15.1 Distrib 10.1.29-MariaDB
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.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 mysql
Once database server has been installed and configured, you need to create a database for Observium.
create database observium;
grant all privileges on observium.* to observium@localhost IDENTIFIED by “StrongPassword”;
flush privileges;
quit
Step 4: Download and Install Observium
Install wget:
- sudo apt-get install wget
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-get update
- sudo apt install rrdtool whois fping imagemagick graphviz \
mtr-tiny nmap python-mysqldb snmp snmpd python-memcache mtr-tiny acl
Download the latest Observium Community edition and extract it.
- cd /opt
- wget http://www.observium.org/observium-community-latest.tar.gz
- tar xvf observium-community-latest.tar.gz
- rm observium-community-latest.tar.gz
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 vim /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’] = ‘StrongPassword’;
$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
- sudo vim /etc/snmp/snmpd.conf
com2sec readonly default 0bs3rv1um
Restart snmpd
- sudo systemctl restart snmpd
Step 5: Configure Nginx
Let’s create the VirtualHost definition for Nginx to load Observium web interface:
$ sudo vim /etc/nginx/conf.d/observium.conf
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.2-fpm.sock;
}
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
Step 6: Configure Observium on Web UI
Import MySQL scheme :
- cd /opt/observium
./discovery.php -u
Add admin user:
Add a user for accessing the Observium portal. You can add more than one user.
- # cd /opt/observium
- # ./adduser.php admin AdminPass 10
Observium CE 17.9.0
Add User
User admin added successfully.
- ./adduser.php violet password 10
Observium CE 17.9.0
Add User
User violet added successfully.
10 is the highest level of access
Now open your web browser and start the installer:
Congratulation, at this point you have observium installed on your server and you are ready to monitor devices such as servers, switches routers or physical machines on your network. In the next article, we shall learn how to use observium to monitor devices on your network.
Reference
https://computingforgeeks.com/how-to-install-observium-on-ubuntu-18-04-lts-with-nginx/