In this tutorial, we explain how to install and configure Observium in Debian step by step.
What is Observium?
Observium is a platform designed for self-discovery network monitoring which requires little maintenance but can support a wide range of devices, platforms, and operating systems, among which we can mention Cisco, Windows, Linux, HP, Juniper, Dell, FreeBSD, Brocade, Netscaler, NetApp and many more.
Observium aims to provide an elegant and powerful interface but intuitive and straightforward for the whole process of network management.
Now we will see how to install Observium in Debian 9.
Step 1: Update System & Install Required Packages
First, we will update the operating system by executing the following commands:
apt-get update -y apt-get upgrade -y
Once updated, we can restart the system by executing the reboot command to apply the changes.
Once the system is started, it will be necessary to install some packages that will be fundamental, for this, we execute the following:
apt-get install snmp fping python-mysqldb rrdtool subversion whois mtr-tiny ipmitool graphviz imagemagick -y
Step 2: Install LAMP Server
LAMP (Linux – Apache – MySQL -PHP) is a set of applications that give us the opportunity to enable a server to host dynamic web sites and applications.
First we will install Apache by executing the following:
apt-get install apache2 libapache2-mod-php7.0 -y
Once Apache is installed, we proceed to start and enable the service at system startup using the following commands:
systemctl start apache2 systemctl enable apache2
Next, we will install PHP 7.0 with their respective libraries using the following line:
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
As soon as this process is finished, we start the installation of the MariaDB database by executing the following line:
apt-get install mariadb-server -y
After installation, we will start and enable this at startup with the following lines:
systemctl start mysql systemctl enable mysql
It will be necessary to configure the database because it is not safe at this time, for this we execute the following line:
we enter our root password and we must answer the following questions in this way:
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
Step 3: Observium User & Database
Once MariaDB is secure, we proceed to create the database with the respective user, for it we execute the following in the first place:
mysql -u root -p
We enter our password and there we execute the following lines one by one:
Creation of the database:
CREATE DATABASE observiumdb DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Creation of the user and grant of privileges
GRANT ALL PRIVILEGES ON observiumdb.* TO 'observium'@'localhost' IDENTIFIED BY 'password';
We left MariaDB:
Step 4: Install Observium
The next step is to download Observium using the following command:
With this line we will download the Open Source Edition since it has a much more complete version called Subscription Edition.
Once downloaded, we will extract the file with the use of the following line:
tar -xvzf observium-community-latest.tar.gz
After this, we will copy the extracted directory in the Apache web root directory with the following command:
cp -ar observium /var/www/html/
Now let's rename the default configuration file like this:
cd /var/www/html/observium cp config.php.default config.php
Then, we will access the file config.php using the desired editor:
There we must leave the following lines with this configuration:
// 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'] = 'observiumdb';
Save the changes using the Ctrl + O keys and exit the editor using Ctrl + X.
Once this change is made, we will configure the default schema for the MySQL database with the following command:
Step 5: Create Virtual Host & Admin User
Now, we will create directories for the storage of events and RRDs:
mkdir rrd logs
We modify the owner of these directories:
chown -R www-data:www-data /var/www/html/observium
It will be necessary to create a virtual host for Apache using the following line:
In this new file we will add the following lines:
<VirtualHost *:80> ServerAdmin [email protected] ServerName example.com DocumentRoot /var/www/html/observium/html <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/html/observium/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Directory> ErrorLog /var/log/apache2/error.log LogLevel warn CustomLog /var/log/apache2/access.log combined ServerSignature On </VirtualHost>
Save the changes using the Ctrl + O keys and exit using Ctrl + X.
Next, we will enable the Observium virtual host file and disable the default virtual host file with the following command:
a2ensite observium a2dissite 000-default
Then, we will allow the apache rewrite module and the PHP mcrypt module with the execution of the next line.
a2enmod rewrite phpenmod mcrypt
Once this is done, we restart Apache:
systemctl restart apache2
We will create the user access to the platform by executing the following:
/var/www/html/observium/adduser.php admin yourpassword 10
Step 6: Permissions & Access to Observium
The next step is to allow the Debian 9 firewall to accept the communication through port 80, this we will do through UFW.
In case of not having it, we will execute the following:
apt-get install ufw -y ufw enable
Once enabled, add port 80:
ufw allow 80
We are ready to access Observium and see its environment, for that we go to a browser in the same local network and in the address bar we will enter the IP address of Debian 9 and we will see the following window where we enter the credentials that we have just created:
Click on Login, and this will be Observium's starting environment:
There we can see each computer in its physical location as it is added. To do this, we will create a cron job to poll and discover devices on the network.
It can be achieved by creating a cron file inside the /etc/cron.d directory:
There we add these rules:
# 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
We save the changes and can restart the cron service like this:
systemctl restart cron
Thus, when you have information, we will have a full administration console:
We have seen how Observium is a useful tool for all this type of management, simplifying the task of visualization, control and reports.