How to Install Observium on CentOS 7

NOTE – May 5th 2017 – Post has been updated to point to latest EPEL RPM

The directions for installing Observium Monitoring on CentOS 7 aren’t exactly accurate.  They have a handful of mistakes and missing steps.  Hopefully this guide will fill in the mistakes and missing parts and get you started on your way.  I know for me it was a bit of a headache getting it to work.  I eventually turned to Turnkey Linux for a template on how to do it.  With the release of the latest community version of Observium (0.16.10 on 26th October 2016),  I decided to give it a shot again.

We assume at the beginning of this tutorial that you have a working CentOS 7 VM that has network connectivity.

The first mistake is that Official Observium Documentation points you to install the RPMForge and EPEL Repositories.  The problem is RPMForge no longer exists, and the EPEL Link they provide is incorrect.

  1.  Install two requirements for logging in remotely to the VM and for getting the EPEL Repository setup.

yum install openssh wget

  1.  Install the EPEL Repository.

wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
rpm -ivh epel-release-7-9.noarch.rpm

  1.  Install the needed packages for Observium.

yum install httpd.x86_64 php.x86_64 php-mysql.x86_64 php-gd.x86_64 php-posix php-mcrypt.x86_64 php-pear.noarch cronie.x86_64 net-snmp.x86_64 net-snmp-utils.x86_64 fping.x86_64 mariadb-server.x86_64 mariadb.x86_64 MySQL-python.x86_64 rrdtool.x86_64 subversion.x86_64 jwhois.x86_64  ipmitool.x86_64 graphviz.x86_64 ImageMagick.x86_64 libvirt.x86_64 net-tools bind-utils

  1.  Make the directories needed for an Observium Install.

mkdir -p /opt/observium && cd /opt

  1.  Download and untar Observium.

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

  1.  Remove the tar File.

rm observium-community-latest.tar.gz

  1.  Enable and Start the MySQL (mariadb) Service.

systemctl enable mariadb
systemctl start mariadb

  1.  Set the root password for MySQL.  We will use Changeme123.

/usr/bin/mysqladmin -u root password ‘Changeme123’

  1.  Login to a MySQL Prompt and configure the database and grant the correct privileges.

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 ‘Changeme123’;
mysql> exit;

  1.  Change Directory into the Observium Folder and copy the default config file to config.php in order to edit the file.

cd observium

cp config.php.default config.php

  1.  Edit the config.php in an editor of your change and Change the db_user and db_pass fields.  The remaining fields can be left to edit later.

post3

  1.  MySQL Strict mode should be enabled, but as of version 5.7 it is enabled by default.  This is a step in the official documentation, but it is one we can skip.

  2.  We run discovery.php script to setup the database schema.

./discovery.php -u

  1.  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”;

Post4.PNG

  1. SELinux needs to be disabled.  This is the simplest way to get Observium to work.

setenforce 0

vim /etc/selinux/config

SELINUX = permissive

Post5.PNG

  1.  Create the RRD Directory and give apache rights to it.

mkdir rrd
chown apache:apache rrd

  1.  Setup httpd.conf for use with Observium.  We assume only Observium will be run on this host.  Be sure to replace the Server in the ServerName line to be that of your fully qualified domain hostname.

vim /etc/httpd/conf/httpd.conf

<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>

Post6.PNG

  1.  Create the logs directory and give apache rights.

mkdir /opt/observium/logs
chown apache:apache /opt/observium/logs

  1.  Create your initial web login user as an admin.  We use user admin, password Changeme123 and level 10 which is admin.

cd /opt/observium
./adduser.php admin Changeme123 10

  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

  1.  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

  1.  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

  1.  Reload cron.

systemctl reload crond

  1.  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.

Post8.PNG

Our next post will cover how to add hosts in the Web Page, how to troubleshoot when those hosts can’t be added, and how to add SuperMicro IPMI polling.

 

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s