Observium on Raspberry Pi

The Challenge

Install Observium on a Raspberry Pi running a vanilla Raspbian.

Observium – Network monitoring with intuition

Observium is an autodiscovering network monitoring platform supporting a wide range of hardware platforms and operating systems including Cisco, Windows, Linux, HP, Juniper, Dell, FreeBSD, Brocade, Netscaler, NetApp and many more. Observium seeks to provide a powerful yet simple and intuitive interface to the health and status of your network.

More see at: www.observium.org

Raspbian

Raspbian is the Debian 7 adapted for the Raspberry Pi. You can get this directly from the raspberrypi.org site with the installation documentation too. This tutorial depends on a vanilla install of raspbian already done.

Download at: http://downloads.raspberrypi.org/raspbian_latest

Software Requirements

Apache
fping
MySQL
Net-SNMP
RRDTool
Graphviz
PHP 5.4+

Skills

Neither be afraid of the text terminal or console, nor of editor like vi, will help a lot in the process of achieving a successful installation.

Steps to take

Install Raspberian

Download the raspberian image and install it according to the installation instructions. Login as user pi and becomes superuser with the command

sudo bash

Install required packages

Run the following commands to install the necessary packages:

apt-get install libapache2-mod-php5 \
php5-cli php5-mysql php5-gd \
php5-mcrypt php5-json \
php-pear snmp fping \
mysql-server mysql-client python-mysqldb \
rrdtool subversion whois \
mtr-tiny ipmitool \
graphviz imagemagick

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

Install required packages

And now download the observium software with:

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

%

Installation success

Hamsters harmed

Minutes to install

Amazing Result

Configuration

Configure all necessary services

First create a default config

cd /opt/observium
cp config.php.default config.php

Getting the database

Create MySQL database

mysql -u root -p
mysql> CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost'
    -> IDENTIFIED BY '<observium db password>';
mysql> flush privileges;
mysql> \q

Edit config.php. Change the options to reflect your installation.

Setup the MySQL database and insert the default schema:

php ./includes/update/update.php
m

Adding directories

Create the directory Observium will store its logs in and create the directory to store RRDs in:

mkdir logs
mkdir rrd
chown www-data:www-data rrd

Configuration

Configure the apache

If the server will be running *only* Observium, change /etc/apache2/sites-available/default to :

<VirtualHost *:80>
       ServerAdmin webmaster@localhost
       DocumentRoot /opt/observium/html
       <Directory />
               Options FollowSymLinks
               AllowOverride None
       </Directory>
       <Directory /opt/observium/html/>
               Options Indexes FollowSymLinks MultiViews
               AllowOverride All
               Order allow,deny
               allow from all
       </Directory>
       ErrorLog  ${APACHE_LOG_DIR}/error.log
       LogLevel warn
       CustomLog  ${APACHE_LOG_DIR}/access.log combined
       ServerSignature On
</VirtualHost>

Alternatively you can create a vhost just for Observium

<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
  </Directory>
</VirtualHost>

mkdir -p /opt/observium/logs;chown www-data:www-data /opt/observium/logs

Enable the apache config

Some small things to finally start the apache web server, enable the php mcrypt module:

php5enmod mcrypt

And now we only have to enable the mod_rewrite module and restart the apache:

a2enmod rewrite
apache2ctl restart

Adding the first user to Observium

Add a first user, use level of 10 for admin:

cd /opt/observium
./adduser.php <username> <password> <level>

Setting up SNMP

Installing the packages

Without SNMP on the Raspberry Pi, we would not have much fun monitoring anything, so lets install the SNMP daemon first

aptitude install snmpd

After that we have to configure it. Change the following lines in the /etc/snmp/snmpd.conf

From:
#  createUser authOnlyUser  MD5 "remember to change this password"
To:
createUser authOnlyUser  MD5 "raspberry"

And the sysLocation from:
sysLocation    Sitting on the Dock of the Bay
sysContact     Me <me@example.org>
To:
sysLocation Raspberry Pi
sysContact  info@linuxpinguin.de

And we have to add the following line to /etc/snmp/snmp.conf to enable the MIBs:

mibdirs /opt/observium/mibs

Now start the SNMPd

service snmpd start
update-rc.d snmpd enable
snmpwalk -v 3 -a MD5 -u authOnlyUser -A raspberry -l authNoPriv 127.0.0.1 .1

Login in the first time

Head over to the website and login with the credentials we created previously.

Screen Shot 2015-02-16 at 20.09.19

And now you will see the start page the first time.

Screen Shot 2015-02-16 at 20.10.12

Go to Add Device
 

Go to Add Device

 

Add device details and save
Add device details

After saving you will see this:

Device is added

Overview of our new device
Overview of our new device
Overview after discovery and polling
Overview after discovery and poll
Follow the steps in the screenshots or the screen cast to enable your first device in Observium.

Discover and poll the Raspberry Pi

To be able to see data from the device it needs to be discovered and polled:

cd /opt/observium
./discover.php -h all
./poller.php -h all

And now we can add this into the crontab to get regular updates on the devices installed:

vi /etc/cron.d/observium

Add these lines:

33  */6   * * *   root    /opt/observium/discovery.php -h all >> /dev/null 2>&1
*/5 *     * * *   root    /opt/observium/discovery.php -h new >> /dev/null 2>&1
*/5 *     * * *   root    /opt/observium/poller-wrapper.py 2 >> /dev/null 2>&1

And now restart cron:

service cron restart

And now have some fun!