LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

Observing devices with Observium - Setting up the server


It’s time for another tutorial! This time I’m taking you into the magical world of Observium and SNMP. Observium is a tool that helps you monitor your servers remotely. But not only your servers; all devices that support SNMP, so that includes most managed switches. It monitors network performance (it basically monitors all network ports), but also server performance (like CPU, I/O), server status (free disk space, memory status), and much more. It’s really the tool out there to get statistics of your servers. Best of all: it’s open source and it’s free!

I’m going to show you how to set up an Observium server. My next tutorial will cover adding devices. This one is going to be lengthy enough as it is and there’s a lot to say about adding a device to Observium, so I will not overload you with too much information. I will show the setup procedure for Ubuntu, as that is where Observium is tested on. This tutorial should also work for Debian. RHEL/CentOS is not recommended for the server, but are fine to be used for devices that you monitor.

Let’s get working!

Server installation

As I said before, Ubuntu is recommended for the server installation. Ubuntu 12.04 LTS works best for this, but 12.10 and 13.10 should work as well. 13.10 or higher will give you a lot of issues as they switched to Apache 2.4 and a lot of other packages changed as well, so using one of those version will probably leave you with a broken installation.

First, update the apt cache. On new installations a lot of packages may not be found because they haven’t been cached yet.

sudo apt-get update

Second step is to install all required packages:

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

This will install Apache, PHP, MySQL, and a lot of other tools needed for Observium to work. I’ve removed subversion from the original package list, as it’s only used for the Observium Subscription Edition. We’re going to install the Community Edition. During installation, you are asked for a root password for MySQL (possibly multiple times). Pick a strong password for this and keep it somewhere safe, like in a KeePass database.

Observium needs a home, so create it:

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

Download Observium:

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

And unpack it (it will automatically put it in the right directory):

sudo tar zxvf observium-community-latest.tar.gz

Head into the observium directory:

cd observium

And copy the default configuration file to an actual configuration file:

sudo cp config.php.default config.php

Next thing we’ve got to do is set up the MySQL user for Observium and create a database that that user can access. So let’s open up MySQL:

mysql -u root -p

This will prompt you for the root password you’ve set before. Once filled in, you’ll be in the MySQL command line client. First thing to do there, is create a database:


Next, create a user and give it access to the database, all with one line:

GRANT ALL PRIVILEGES ON observium.* TO ‘observium’@’localhost’ IDENTIFIED BY ‘<password>’;

Again, pick a strong password here, and replace <password> with your password. Now, exit the MySQL client:


And you’re good to go edit the Observium configuration file. Open it up:

sudo vim config.php

And fill out the following config options:

$config[‘db_user’] = “USERNAME”;
$config[‘db_pass’] = “PASSWORD”;

Replace USERNAME with ‘observium’ and PASSWORD with the password you have the observium database user. Save the file and exit vim.

Now we can set up Observium by running the following file. This will populate the database with the necessary tables.

php includes/update/update.php

This could give some errors up to revision 006, but I personally didn’t get them.

Next, create a directory for RDD:

sudo mkdir rrd

And set the right permissions on it:

sudo chown www-data:www-data rrd

The ‘rdd’ folder is now owned by www-data. Apache runs the web server as that user, so the Apache process can now write to that directory. Observium writes .rrd files for each device to this directory. RDDTool is a data logging and graphing system, so it gets you all these fancy graphs.

Now we have to create the virtual host configuration for Observium. You can either add a new virtual host or alter the default one. I’m going to alter the default one, as my server is only going to contain observium and nothing else. Open up the default virtual host file:

sudo vim /etc/apache2/sites-available/default

And make sure the contents match this:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /opt/observium/html
<Directory />
Options FollowSymLinks
AllowOverride None
<Directory /opt/observium/html/>
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

You may change the ServerAdmin e-mail address to one of your choosing, but it’s not required. This e-mail address will be used on error pages, so make sure not to enter your super private e-mail address here. Save the file.

We now need to enable the Apache rewrite module, which allows Observium to rewrite URLs:

sudo a2enmod rewrite

And finally, restart Apache:

sudo service apache2 restart

And you’re good! Observium is now running. It’s not doing much yet and you can’t log in, but it works. Visit the IP address of your server or the domain name you pointed there and you should see the Observium login screen. Let’s configure observium (don’t worry, this is just a few steps).

Configuring Observium

Make sure you are in the observium directory:

cd /opt/observium

And run the following script:

./adduser.php <username> <password> <level>

Replace <username> with a username you would like to use, <password> with a strong password, and <level> with 10. Level 10 means you have all access (it’s the ‘admin’ level). So, a filled out command should look like:

./adduser.php mpkossen AStrongPassword 10

The user should now be added and you should be able to log in to Observium.

Finally, we should set up some cron jobs that Observium needs. Open up the generic cron tab:

sudo vim /etc/crontab

And add the following 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 1 >> /dev/null 2>&1

You should not place this in a user’s crontab, as it includes a username. So don’t use ‘crontab -e’ or something.

These three cron jobs are for discovering devices (new and existing) and one that polls them for data, which is basically the most essential part of Observium.

Once this is done, you are all set! Observium is up and running and you’re ready to add devices!

Final notes

This installation is a bit of a lengthy process by the looks of it. If you’ve done it before, though, you know what to do at each step and it’ll go pretty fast. Of course, you probably only ever need one Observium server, so that’s a moot point.

Next week, I’m going to show you how to add devices to your Observium installation. You could also have a go and figure it out yourself, of course. Or, if you want something else to do, try to secure the Observium server with an SSL connection so not all data you’re looking at goes over the internet as plain text.

Up next week: Observing devices with Observium – Adding a device



  1. Cool, I’m trying it now.

    March 29, 2014 @ 7:38 am | Reply

    Great tool and thank you for posting the getting started guide.
    I’ve forged ahead and setup my nodes now, but one thing I have problems with on my Centos 6.x nodes is getting the OS version to show within Ovservium. Tried the distro patch, but didn’t seem to help. Hopefully you will cover this in your next post.
    Looking forward to part two of this guide.


    March 29, 2014 @ 8:14 pm | Reply
  3. Mr. Pragma:

    With all due respect, I got slightly irritated when I read “Ubuntu” and I stopped reading when I read “Apache”.

    I don’t know about Observium, maybe it’s paradise in bytes. But I do know that using Apache for such a job is like using a 40 ton truck to get some cheeseburgers at the next drive in. This doesn’t mean that apache is bad, it simply means that it’s way too fat for that kind of job. Similarly using PHP for such a sensitive job is akin to leaving open the doors to the data center to have a good look at them blinkenlights…

    The combination of Ubuntu, apache and PHP is not a solution but rather a symbol of “modern times” in something that should be done by proper engineers. Let’s talk again about using PHP for systems management once PHP will be grown up enough to reliably and securely handle moms and dads and some restaurant web sites, OK.

    No, not everyone desiring to run a VPS must be an engineer. But this whole thing just looks like an invitation to serious trouble.

    But then, maybe it’s just me getting old and conservative. After all there are banking sites using PHP and those guys haven’t been shot yet.

    Anyway thanks for all the efforts made and lots and lots of good work by our hosts here.
    I have been looking time and again at diverse places like WHL, VPS comparison sites and whatnot. In the end I always found my providers here at LEB. And 3 out of 4 times I was lucky. So, the good people here at LEB must do something damn right and well – and very valuable to many.

    Thank you!

    March 30, 2014 @ 10:58 am | Reply
    • jaiho:

      Apache is like a ferrari, it depends on what kinda fuel you put in it. If you put in cooking oil the ferrari craps itself and explode. If you put in racing fuel however, it’s fast. Perhaps it is time to blame what kind of fuel you can afford instead of blaming the car itself.

      April 4, 2014 @ 10:41 pm | Reply
  4. jvnadr:

    Maarten, you are God! I am installing opservium now for the first time and just take a break to surf a litle to the web. So, just say your tutorial I’ll follow it. Thanks!

    March 30, 2014 @ 4:55 pm | Reply
  5. NStorm:

    Never heard of Observium before. Checked its screenshots – looks nice.
    But I still prefer Zabbix, just because I’m used to it.
    Also Observium got their own license, its not FOSS.

    March 30, 2014 @ 11:34 pm | Reply
    • Silvenga:

      Observium is FOSS. It is under the QPL license and is Open Source Initiative approved.

      April 1, 2014 @ 1:41 am | Reply
  6. emg:

    Thanks to Maarten for his wonderful tutorials.

    Question: Has anyone tried this observium installation procedure on Debian instead of Ubuntu?

    March 31, 2014 @ 10:24 pm | Reply
    • Juanako:

      Yes, I have it running on Debian and it is exactly the same.

      April 1, 2014 @ 3:13 am | Reply
  7. Wynne:

    Might be worth mentioning that Observium only works with Ubuntu 12.04 and 13.04 and Debian 7 (if installing on one of those distros) as pointed out here:


    May 21, 2014 @ 2:22 am | Reply
  8. TCP:

    Thank you so much !

    July 24, 2014 @ 5:25 am | Reply
  9. alex:

    Where can we find your other tutorial?
    Up next week: Observing devices with Observium – Adding a device?

    October 2, 2014 @ 5:15 pm | Reply
  10. gena:

    thanks wonderful tutorial

    October 6, 2019 @ 4:54 am | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

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