Introduction
Today we will be installing Observium
Observium is a Network Management and Monitoring System that collects data from multiple devices using SNMP and allows you to monitor all of the networks devices via an easy to use interface. It is PHP-based and uses a MySQL database to store data.
Note
This guide works with Ubuntu 16.04
Install
Connect to your server via SSH
ssh [email protected]
Install Dependencies
sudo apt-get install libapache2-mod-php7.0 php7.0-cli php7.0-mysql php7.0-mysqli php7.0-gd php7.0-mcrypt php7.0-json php-pear snmp fping mysql-server mysql-client python-mysqldb rrdtool subversion whois mtr-tiny ipmitool graphviz imagemagick apache2
Enter the Mysql password for the root user. Note: For security make this one different than your server's password, and try not to use this user in any application that requires a database to store and pull data from.
Download and Extract Observium
sudo mkdir -p /opt/observium
cd /opt
sudo wget http://www.observium.org/observium-community-latest.tar.gz
sudo tar zxvf observium-community-latest.tar.gz
Configuration
create the MYSQL database and userEnter your MySQL password that you gave the root user from before
mysql -u root -p
Once in MySQL enter the following commands to create the database, the user and to allow the user access to the database.
CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Make sure to change the Observium database password with your own, you will need this in the next step.
GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost' IDENTIFIED BY 'dbpassword';
exit
Changing the config file
cd observium
sudo cp config.php.default config.php
Change the setting on the config.php to reflect your systems settings
sudo nano config.php
Set the username and password on the observium config file and an email address for alerts to get sent to.
<?php
## Check http://www.observium.org/docs/config_options/ for documentation of possible settings
// Database config --- This MUST be configured
$config['db_extension'] = 'mysqli';
$config['db_host'] = 'localhost';
$config['db_user'] = 'observium';
$config['db_pass'] = 'dbpassword';
$config['db_name'] = 'observium';
// Base directory
#$config['install_dir'] = "/opt/observium";
// Default community list to use when adding/discovering
$config['snmp']['community'] = array("public");
// Authentication Model
$config['auth_mechanism'] = "mysql"; // default, other options: ldap, http-auth, please see documentation for config help
// Enable alerter
$config['poller-wrapper']['alerter'] = TRUE;
//$config['web_show_disabled'] = FALSE; // Show or not disabled devices on major pages.
// Set up a default alerter (email to a single address)
$config['email']['default'] = "[email protected]";
$config['email']['from'] = "Observium <[email protected]>";
$config['email']['default_only'] = TRUE;
// End config.php
Control +X to write file in nano.
Give Apache user www-data ownership of the Observium web files
sudo chown -R www-data:www-data /opt/observium/html/
Run this script to Setup the MySQL database and insert the default schema:
./discovery.php -u
Create required directories
Directory where logs are storedsudo mkdir logsDirectory for the round-robin database
sudo mkdir rrdGive the apache user and group ownership of the directory
sudo chown www-data:www-data rrd
Configuring Apache web server
sudo nano /etc/apache2/sites-available/000-default.confMake the file look like this ```apache
sudo phpenmod mcryptEnable mod_rewrite for Observium's cleaner URLs:
sudo a2enmod rewriteLast but not least we enable PHP and switch to mpm_prefork
sudo a2dismod mpm_event sudo a2enmod mpm_prefork sudo a2enmod php7.0Restart Apache
sudo service apache2 restart
Getting Started
Adding an Admin User./adduser.php admin password 10Adding your First SNMP enabled device to monitor
./add_device.php <hostname> <community> v2cNote: if your internal network can't resolve hostnames, add them to your hosts file. Also make sure that the devices you are monitoring support SNMP or you will not be able to add them, also if your device supports sending logs to a syslog server point it to the Observium IP.
Adding the cron jobs
Create this cron file
sudo nano /etc/cron.d/observium
Add the following content inside. these jobs are required by Observium for Polling and Discovering Devices
# 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 4 >> /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
Finally Grant correct permissions to fping to fix unable to ping error
chmod +s /usr/bin/fping
That's It
Open The panel and Login with the password you set earlier
http://Server-IP