We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Install Observium Monitoring Tool on Rocky Linux 9 / AlmaLinux 9

Learn how to – Install Observium Monitoring Tool on Rocky Linux 9 / AlmaLinux 9.

Nowadays, most businesses depend on applications to run. This makes system monitoring an important task for every system administrator. It helps identify the health and performance of applications or servers. There are several monitoring stacks for Linux systems. They include New Relic, Dynatrace, Elastic Stack, Prometheus, Zenoss, N-able RMM, PRTG Network Monitor, Datadog Infrastructure Monitoring, Zabbix, Nagios e.t.c

Observium is a low-maintenance network auto-discovering monitoring platform. It is supported on several devices such as Linux, Windows, HP, Juniper, Dell, FreeBSD, Brocade, Netscaler, NetApp, Cisco e.t.c. Observium was developed with the main aim of providing a beautiful, powerful, simple, and intuitive interface for network health the status monitoring.

Observium is made up of several components that work together:

  • RRDtool API: This allows us to globally support specific paths, options, or features such as rrdcached, and easy debugging.
  • Database API: It allows connection to the MySQL database and print the queries when debugging, without needing code for that anywhere.
  • SNMP API: It allows users to transparently run v1, 2c, or 3 queries, set specific retries or timeouts e.t.c
  • Agent: They send network metrics to the Observium for monitoring

Observium comes in two main editions:

  • Observium Community: This is available to everyone for free and receives updates and features twice annually.
  • Observium Professional: provides advanced features and daily updates to users at a small yearly fee.

Observium offers the following advantages and features:

  • Ease planning: It helps users streamline capacity and disaster recovery planning with the network metrics collection and visual representations of collected data.
  • Improve reliability: It improves network reliability with the information provided and you can respond to potential issues before they occur.
  • Expanded visibility: It improves the general view of the network infrastructure by collecting and displaying the metrics about the service and protocols.
  • Extensive device support: It supports many devices and operating systems spanning both standard and private MIBs.
  • External integration: it can be integrated with third-party applications and you can also write custom application modules to collect and report data from your applications.

In this guide, we will walk through how to install Observium Monitoring Tool on Rocky Linux 9 / AlmaLinux 9.

Install Observium Monitoring Tool on Rocky Linux 9 / AlmaLinux 9

Before we begin, ensure that remote SSH has been enabled on your system.

sudo yum install -y openssh tar vim

Start and enable the SSH server

sudo systemctl enable sshd
sudo systemctl start sshd

#1. Install the Required Packages

We need to install several packages that include PHP 7.4 on Rocky Linux 9 / AlmaLinux 9. First, add the required repositories:

sudo yum -y install yum-utils epel-release
sudo yum -y install http://yum.opennms.org/repofiles/opennms-repo-stable-rhel8.noarch.rpm
sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-9.rpm

Now enable PHP 7.4

sudo dnf module enable php:remi-7.4 -y

Now install all the required packages:

sudo yum -y install wget httpd php php-opcache php-mysqlnd php-gd php-posix php-pear cronie net-snmp 
            net-snmp-utils fping mariadb-server mariadb rrdtool subversion whois ipmitool graphviz 
            ImageMagick php-sodium python3 python3-PyMySQL mariadb-connector-c-devel

You can also install libvirt if you want to monitor virtual instances:

sudo yum -y install libvirt

#2. Download Observium archive

Begin by creating a directory for Observium:

sudo mkdir /opt/observium && cd /opt

Option 1: Downloading Observium Community Edition

Download the latest Observium Community Edition archive:

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

Extract the archive:

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

Option 2: Downloading Observium Professional Edition

For the Professional Edition obtain a valid Observium subscription, and use one of the automated SVN release repositories below to download Observium.

  • For the Stable Train:
sudo svn co https://svn.observium.org/svn/observium/branches/stable observium
  • For the current Train
svn co https://svn.observium.org/svn/observium/trunk observium

#3. Install and Configure MariaDB Database

Observium requires MySQL 5.7+ or MariaDB 10.3+. The default MariaDB version available in the Rocky Linux 9 / AlmaLinux 9 repositories is 10.5. We will install this version with the command:

sudo dnf -y install mariadb-server mariadb

Once installed, start and enable the service:

sudo systemctl enable --now mariadb

Harden the instance by setting the root password:

$ sudo mysql_secure_installation
Switch to unix_socket authentication [Y/n] y

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
.....
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
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Now create a database for Observium

$ mysql -u root -p
CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL ON observium.* TO 'observium'@'%'  IDENTIFIED BY 'Str0ngPassw0rd';
FLUSH PRIVILEGES;
EXIT

#4. Configure Observium Monitoring

Now navigate to the Observium directory:

cd observium

Create a configuration file from the template:

sudo cp config.php.default config.php

Now open the file for editing.

sudo vim config.php

Adjust the database details as shown.

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

Also, add the below line for fping:

$config['fping'] = "/usr/sbin/fping";

To verify the fping $PATH, use the command

$ which fping
/usr/sbin/fping

Configure SELinux by setting it to permissive mode:

sudo setenforce 0 && sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

Now import schemas to the database using the command:

 ./discovery.php -u

Sample Output:

#5. Configure Apache for Observium

We will create an rrd directory under /opt/observium used to store the RRD’s.

sudo mkdir rrd

Now create the Apache virtual host file for Observium.

sudo vim /etc/httpd/conf.d/observium.conf

Add the below lines to the file:

<VirtualHost *>
   DocumentRoot /opt/observium/html/
   ServerName  observium.ownyourlife.com.ng
   CustomLog /opt/observium/logs/access_log combined
   ErrorLog /opt/observium/logs/error_log
   <Directory "/opt/observium/html/">
     AllowOverride All
     Options FollowSymLinks MultiViews
     Require all granted
   </Directory>
</VirtualHost>

Save the file and create the log directory:

sudo mkdir /opt/observium/logs
sudo chown -R apache: /opt/observium

Restart the Apache service:

sudo systemctl restart httpd

Allow port 80 through the firewall:

sudo firewall-cmd --add-port=80/tcp --permanent
sudo firewall-cmd --reload

#6. Create the Observium Admin User

Add the Observium admin user with a user level of 10.

cd /opt/observium

Remember to provide an appropriate username and password.

$ ./adduser.php admin Str0ngAdminPassw0rd 10
Observium CE 22.5.12042
Add User

User admin added successfully.

Create a Cron Job for Observium

sudo vim /etc/cron.d/observium

Add the below line to the file:

# 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

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

Reload the Cron process:

sudo systemctl reload crond

Restart httpd service:

sudo rm /etc/httpd/conf.d/welcome.conf
sudo systemctl restart httpd

#7. Access Observium WebUI

To access the Observium web interface, use the URL http://IP_Address or http://domain_name

Login using the created admin user. Once authenticated, you will see the below dashboard.

#8. Add Devices to Observium

For Observium to monitor your environment/device, you need to install and configure SNMP.

A. Install and configure SNMP

Ensure that the client system has the SNMP package:

##On Debian/Ubuntu
sudo apt-get -y install snmpd

##On CentOS/Rocky/Alma Linux
sudo yum -y install net-snmp

Once installed, copy the available file to a backup file:

sudo mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak

Now configure SNMP:

sudo vim /etc/snmp/snmpd.conf

Create a config file with the SNMP community string as shown:

# Listen to all interface
agentAddress udp:161

# Change "observium" to your preferred SNMP community string
com2sec readonly default observium
group MyROGroup v2c readonly
view all included .1 80
access MyROGroup "" any noauth exact all none none

# Update your location here
syslocation [40.705311,-74.2581883]
syslocation Africa, Nairobi
syscontact computinforgeeks Admin <admin@ownyourlife.com.ng>

# Distro Detection
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/bin/distro

We will obtain the client distro information at /usr/bin/distro. So we need to obtain this file from our Observium host.

From the host running Observium, use SCP to copy to the client as shown:

sudo scp /opt/observium/scripts/distro remote_user@remotehost_IP:~/

In the above command, replace remote_user with the user on the client machine and remotehost_IP with its IP Address

Once the config has been obtained, copy it to your $PATH

##From the Client's machine terminal
sudo cp distro /usr/bin/distro
sudo chmod +x /usr/bin/distro

Now start and enable SNMP:

sudo systemctl enable --now snmpd

Also, allow the port through the firewall:

##For UFW
sudo ufw allow 161

##For Firewalld
sudo firewall-cmd --permanent --add-port=161/udp
sudo firewall-cmd --reload

B. Add Devices to Observium

Once SNMP has been configured on the client machine. There are two ways of how ton add devices on Observium.

The first and easiest way is via the command line:

##From the Observium host:
cd /opt/observium

To add a host, use the command with the below syntax:

./add_device.php <hostname> <community> v2c

As long as SNMP is configured, you can add the device. For example

##Localhost
$ ./add_device.php localhost observium v2c

##Remote device
$ ./add_device.php 192.168.205.13 observium v2c

Remember observium is the SNMP community configured in the SNMP config file.

Sample Output:

Now perform an initial discovery and polling to get data for the new device:

./discovery.php -h all
./poller.php -h all

The other method to add a device is via the web Ui by navigating to Devices->Add Device

Provide the device details as shown above and click Add device.

To view the added devices, navigate to All devices

View Graphs for the desired server by clicking on it.

View Graphs about the system.

View Netstats metrics

View poller metrics:

Verdict

We have successfully walked through how to install Observium Monitoring Tool on Rocky Linux 9 / AlmaLinux 9. Proceed and perform network health status monitoring with Observium.

Related posts:

Cart

Your Cart is Empty

Back To Shop