observium
------------
Observium on CentOS 7 [ A Network Management and Monitoring System ]
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
rpm -ivh http://yum.opennms.org/repofiles/opennms-repo-stable-rhel7.noarch.rpm
Now, create the database for Observium installation with the following information.
DB Name: observium
User Name: observium
DB Password: password
mysql -u root -p [**Note MySQL will prompt you for the root password set above**]
mysql> CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost' IDENTIFIED BY 'Password';
mysql> exit;
yum -y install wget httpd php71w php71w-opcache php71w-mysql php71w-gd php71w-posix php71w-mcrypt net-snmp net-snmp-utils fping MySQL-python rrdtool subversion jwhois ipmitool graphviz ImageMagick php71w-pear
pear install Net_IPv4-1.3.4
pear install Net_IPv6-1.2.2b2
**Set time zone in php.ini file.
For CentOS / RHEL:# vi /etc/php.ini
date.timezone = Asia/Dhaka
**Install and Configure Observium
cd /opt
wget http://www.observium.org/observium-community-latest.tar.gz
tar -zxvf observium-community-latest.tar.gz
cd /opt/observium
cp config.php.default config.php
# vi config.php
$config['db_host'] = 'localhost';
$config['db_user'] = 'observium';
$config['db_pass'] = 'XXXXXXXX';
$config['db_name'] = 'observium';
Then add an entry for fping binary location to config.php
Add entry
$config['fping'] = "/usr/sbin/fping";
$config['fping6'] = "/usr/sbin/fping6";
**Create rrd and logs directory.
cd /opt/observium
mkdir rrd logs
chmod 775 rrd logs
**Set ownership.
chown -R apache:apache /opt/observium/{logs,rrd}
**Create Apache configure file for Observium Web Interface.
# vi /etc/httpd/conf.d/observium.conf
**Add the following configuration details to the above file. Change the server name (observium.worldcm.net) as per your requirement.
---------------------------------------------------
Alias /observium "/opt/observium/html/"
DocumentRoot "/opt/observ ium/html/"
<Directory "/opt/observium/html/">
Options +FollowSymlinks
AllowOverride All
order allow,deny
allow from all
Require all granted
</Directory>
-------------------------------------------------------
<VirtualHost *:80>
DocumentRoot /opt/observium/html/
ServerName observium.worldcm.net
CustomLog /opt/observium/logs/access_log combined
ErrorLog /opt/observium/logs/error_log
AllowEncodedSlashes NoDecode
<Directory "/opt/observium/html/">
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
------------------------------------------------
# vim /etc/httpd/conf/httpd.conf [ add this line at the end]
<VirtualHost *:80>
DocumentRoot /opt/observium/html/
ServerName observium.domain.com
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>
-------------------------------------------------------------------
***Optional: Disable the default site in case your server going to host only this site***.
rm -f /etc/httpd/conf.d/welcome.conf
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
systemctl restart httpd
systemctl enable httpd
***Run the below command to insert the initial MySQL scheme.
# cd /opt/observium
# ./discovery.php -u
Output:
___ _ _ / _ \ | |__ ___ ___ _ __ __ __(_) _ _ _ __ ___ | | | || '_ \ / __| / _ \| '__|\ \ / /| || | | || '_ ` _ \ | |_| || |_) |\__ \| __/| | \ V / | || |_| || | | | | | \___/ |_.__/ |___/ \___||_| \_/ |_| \__,_||_| |_| |_| Observium Community Edition 17.9.0 http://www.observium.org Install initial database schema ... done. -- Updating database/file schema 310 -> 311 # (db) . Done (0s). 311 -> 312 # (db) .... Done (0s). 312 -> 313 # (db) Done (0s). 313 -> 314 # (db) Done (0s). 314 -> 315 # (php) . Done (0s). 315 -> 316 # (db) . Done (0s). 316 -> 317 # (db) .. Done (0s). 317 -> 318 # (db) . Done (0s). 318 -> 319 # (db) ....... Done (1s). 319 -> 320 # (db) . Done (0s). 320 -> 321 # (db) . Done (0s). 321 -> 322 # (db) . Done (0s). 322 -> 323 # (db) ... Done (0s). 323 -> 324 # (db) ... Done (0s). 324 -> 325 # (db) .... Done (0s). 325 -> 326 # (db) . Done (0s). 326 -> 327 # (db) . Done (0s). 327 -> 328 # (db) . Done (0s). 328 -> 329 # (db) . Done (0s). 329 -> 330 # (db) . Done (0s). 330 -> 331 # (db) . Done (0s). 331 -> 332 # (db) ... Done (0s). 332 -> 333 # (php) Done (0s). 333 -> 334 # (db) . Done (0s). 334 -> 335 # (php) Done (0s). 335 -> 336 # (db) . Done (0s). 336 -> 337 # (db) . Done (0s). 337 -> 338 # (db) . Done (0s). 338 -> 339 # (db) ... Done (0s). 339 -> 340 # (db) ... Done (0s). 340 -> 341 # (db) ........ Done (0s). 341 -> 342 # (db) ............... Done (0s). 342 -> 343 # (db) ... Done (0s). 343 -> 344 # (db) .... Done (0s). 344 -> 345 # (db) .. Done (0s). 345 -> 346 # (db) . Done (0s). 346 -> 347 # (db) . Done (1s). 347 -> 348 # (db) F Done (0s, 1 errors). 348 -> 349 # (db) .. Done (0s). 349 -> 350 # (php) Done (0s). 350 -> 351 # (db) ..... Done (0s). 351 -> 352 # (db) .. Done (0s). -- Done.
Having some errors during this operation is OK.
./discovery.php -u
In CentOS 7 the locations of fping and ping differ from that of where Observium expects them to be. Lets override those values in the config but adding these two lines.
$config[‘ping’] = “/usr/bin/ping”;
$config[‘fping’] = “/usr/sbin/fping”;
***Add a user for accessing the Observium portal.
*** Create your initial web login user as an admin. We use user admin, password xxxxxx and level 10 which is admin.
# cd /opt/observium
# ./adduser.php admin xxxxxxx 10
FirewallD:
firewall-cmd --permanent --add-port=80/tcp firewall-cmd --reload
Post Setup
Once the Observium setup is complete, perform the below steps.
vi /opt/observium/config.php
Add the below information to the config.php file.
$config['fping'] = "/sbin/fping";
Create the cronjob information so that automatic discovery and polling for newly added devices can happen automatically.
vi /etc/cron.d/observium
Content:
# 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
**** Add your first device. Be sure that SNMP is enabled on the device and that you know the community. For us we will use our Mikrotik Switch.
./add_device.php 10.0.1.2 public v2c
***** Now that Observium knows about the host, lets discovery it and poll for the data off the switch.
./discovery.php -h all
./poller.php -h all
****Create a cron job to run discovery and polling on a regular interval. A Note in the Observium documentation states.
The below example includes a username, so will only work in /etc/crontab or /etc/cron.d/observium. It will NOT work in a user crontab edited with crontab -e without removing the username.
So we create the cron file in /etc/cron.d/observium.
# 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 multi threaded poller wrapper every 5 minutes
*/5 * * * * root /opt/observium/poller-wrapper.py 8 >> /dev/null 2>&1
# Run housekeeping script daily for syslog, event log 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 cron.
systemctl reload crond
Set httpd to start on boot.
systemctl enable httpd
systemctl start httpd
That is about it for the setup of Observium. The official documentation states that you need to open firewall ports. Since the firewall is not installed by default, I have skipped those steps. If you need them they are.
#Permit HTTP through the server’s default firewall
firewall-cmd –permanent –zone=public –add-service=http
firewall-cmd –reload
If everything went correctly you will be greeted with the login hamster.
-------------