Installing Observium on Debian 8 (Jessie)

So, i’ve got a fresh Debian 8 machine and i’d like to install Observium.
My first step is to install a extra source to my apt sources list, since i want it to run on PHP7, and php7 is’nt in the default repository.

Preparations

sudo vi /etc/apt/sources.list.d/dotdeb.list

Add  the following lines to the new file:

deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all

Now add the GPG key of dotdeb.

wget https://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg

Now we need to update the new packages.

sudo apt-get update

Now we’re ready to install the observium dependancies.

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

During installations you’ll be asked to create a mysql root password, please choose a secure password and save it somewhere for later. We’ll need this.

Installing observium

After the install we need to create a directory for observium. Personly i like it in /var/www/html/ because it’s a webpage, but that’s up to you.

mkdir /var/www/html/observium
cd /var/www/html/observium

Now we’re going to download the observium files and extract them in the newly created folder.

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

Now clean up the rar.gz, and move into the new directory.

rm observium-community-latest.tar.gz
cd observium

Mysql Config

Now we need to create the Mysql database.
We’ll need the root credentials you saves before.
Login to mysql

mysql -u root -p

Now create a user, change the values “newuser” and “password”
I always use a strong password generator to create a password, simply because you only need the password once and it’s not like your going to use this password on a regular basis.

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

Now create a database called observium.

CREATE DATABASE observium;

Grant rights to the database for the new user, replace “newuser” to the user you created.

GRANT ALL PRIVILEGES ON  observium.* TO 'newuser'@'localhost';

Now close MYSQL

mysql> exit

Basic config

Next copy the default config to a live config.

cp config.php.default config.php

And edit the settings to the created Database and User

vi config.php

Edit the Database connections:


// Database config --- This MUST be configured
$config['db_extension'] = 'mysqli';
$config['db_host'] = 'localhost';
$config['db_user'] = 'USERNAME';
$config['db_pass'] = 'PASSWORD';
$config['db_name'] = 'observium';

And edit the Base Directory if you edited like i did

// Base directory
#$config['install_dir'] = "/opt/observium";

To:


// Base directory
$config['install_dir'] = "/var/www/html/observium/observium";

If you’d like to receive e-mail notifications you can edit the following lines to your needs:


// Set up a default alerter (email to a single address)
$config['email']['default'] = "user@your-domain";
$config['email']['from'] = "Observium <observium@your-domain>";
$config['email']['default_only'] = TRUE;

If you’re done, save the config and run the following command.
./discovery.php -u

This will run a script to config the Database.

After this script is done, you need to create 2 directories: logs and rrd

mkdir logs
mkdir rrd

The rrd folder needs to be accesable for www-data so we need to change the permissions.

chown -R www-data:www-data rrd

 

Configuring apache

We’re going to use this machine to run a dedicated instance of observium, so we only need to edit the 00-default.conf of apache2.
Open the file

vi /etc/apache2/sites-enabled/000-default.conf

 

Now delete all the lines, and change them to the following config:

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/observium/observium/html/

SetHandler application/x-httpd-php

Options FollowSymLinks
AllowOverride None

DirectoryIndex index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerSignature On

 

We need to enable the php mcrypt module:

phpenmod mcrypt

 

We need to enable the rewrite mod:

a2enmod rewrite

 


Restart Apache2

service apache2 restart

 

Configure admin webuser

We need to create a admin user with lvl 10 permission.

./adduser.php USERNAME PASSWORD 10

 

Configure cron

Edit the crontab

vi /etc/cron.d/observium

Add the following config


33 */6 * * * root /var/www/html/observium/observium/discovery.php -h all > /dev/null 
*/5 * * * * root /var/www/html/observium/observium/discovery.php -h new > /dev/null 
*/5 * * * * root /var/www/html/observium/observium/poller-wrapper.py 2 > /dev/null 

That’s it. You’ve now succefully created a user, and created a cron so it updates the devices automatically.
In the next post, we’ll add a new device to the config via de webinterface.

6 Comments

  1. Pierluigi 4 March 2017 at 19:26

    Ciao, intanto grazie per l’articolo che hai pubblicato perchè e molto preciso e di semplice comprensione… dopodichè ti volevo chiedere un’informazione…io ho fatto come ha scritto tu e infatti mi collego via web alla console di observium ma purtroppo non vede nessuna interfaccia di rete, infatti su PORT mi dice che non ne ho nemmeno una… come posso risolvere? mi puoi dare una dritta?

    P.S. ho montato observium su una debian 8.0

    Grazie mille!!!

    1. pjeursen 5 March 2017 at 16:55

      I’m sorry but i don’t understand Italian.
      Could you write your problem in english? Maybe i’ll be able to help you. As far as google translate says, your having issues with your network interface, correct?

  2. Abdul 16 May 2017 at 12:21

    when i run phpenmod mcrypt i get the following

    root@observium:/var/www/html/observium/observium# phpenmod mcrypt
    WARNING: Module mcrypt ini file doesn’t exist under /etc/php/7.0/mods-available
    WARNING: Module mcrypt ini file doesn’t exist under /etc/php/7.0/mods-available
    root@observium:/var/www/html/observium/observium#

    1. pjeursen 16 May 2017 at 13:44

      Hi, thank you for reading my post.
      It looks like you didn’t install phpmcrypt.
      You can try to run apt-get install php7.0-mcrypt

      1. Abdul 16 May 2017 at 15:36

        yes your right i didn’t follow every step, its all working now, happy days.

  3. Abdul 16 May 2017 at 21:33

    thank you excellent guide well explained in simple steps and terms, the only one problem i have now is the corn job isn’t running for some reason its not polling as it should every 5 miniutes for new jobs i must be doing a newbie error

Leave a comment

Your email address will not be published. Required fields are marked *