Open-Source Monitoring

Historical Graphing and Metrics with Observium


There are many different monitoring solutions which allow you to graph system metrics and keep them for historical purposes. Some of these are cloud-based, but cost a lot of money for any real retention. Observium is an open-source monitoring application that allows you to monitor systems over SNMP and its custom agent. It then generates graphs automatically for common system metrics such as CPU usage, RAM usage, disk usage, etc.


  1. Install Observium and dependencies
  2. Configure Observium
  3. Set up monitoring of server to demonstrate functionality

Install Observium & Dependencies

Observium has a number of dependencies. For your convenience, I’m listing the key ones below:

  1. Apache Web Server
  2. MySQL (or MariaDB)
  3. PHP (along with php-mysql, php-mysqli, php-gd, php-mcrypt, php-json, php-pear)
  4. Rrdtool
  5. Subversion (this is required for the subscription version updates, not essential)

For the purposes of this article, I’m using Ubuntu 16.04.2, as a Debian-based OS is recommended by the Observium developers. So, let’s get started by installing all of the required dependencies: 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 libvirt-bin

During this process, you’ll be prompted to set a root password for MySQL. Go ahead and do this and make a note of the password.

Now, let’s create a directory in which Observium can reside: mkdir -p /opt/observium && cd /opt

This article is focused on the free version of Observium, so we’re going to go ahead and download the community edition: wget && tar zxvf observium-community-latest.tar.gz

Configure Observium

Now we’re ready to configure Observium. Let’s start by changing the /opt/observium directory with cd /opt/observium . Now we can use the example config.php file to create our own by executing: cp config.php.default config.php .

Now let’s create an empty database and user within MySQL to allow Observium to use MySQL. This can be done by going into MySQL with mysql -uroot -p and the password you set earlier. Then, you’ll want to execute the following commands:

mysql> CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> GRANT ALL PRIVILEGES ON observium.* TO ‘observium’@’localhost’ IDENTIFIED BY ‘password’;

As we’ve now created these details, we can edit config.php and fill out the database connection details for Observium to look like the following:

$config['db_extension'] = 'mysqli';
$config['db_host']      = 'localhost';
$config['db_user']      = 'observium';
$config['db_pass']      = 'password';
$config['db_name']      = 'observium';

Let’s run ./discovery.php -u to populate the database within MySQL. This should show an output similar to the following:

Let’s create a logs directory and rrd directory to house these files: mkdir logs && mkdir rrd && chown www-data:www-data rrd . You’ll note that we’ve set the correct permissions on the rrd folder to allow the webserver to write to the folder.

Moving on to the Apache configuration, we’re utilising Apache 2.4 in this example, so we need to edit the file /etc/apache2/sites-available/000-default.conf and replace all of its contents with the following:

    ServerAdmin webmaster@localhost
    DocumentRoot /opt/observium/html
      SetHandler application/x-httpd-php
            Options FollowSymLinks
            AllowOverride None
            DirectoryIndex index.php
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
    ErrorLog  ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog  ${APACHE_LOG_DIR}/access.log combined
    ServerSignature On

At this point, we’ll also want to enable the PHP module mcrypt with: phpenmod mcrypt

Finally, let’s enable mod_rewrite and restart Apache:

a2enmod rewrite
apache2ctl restart

We’re almost there! Before we can log in to the Observium GUI, we need to create a user with administrative privileges. This can be done by running: ./adduser.php admin password 10 . (Substitute admin for any username you want to use and password for any password! The 10 refers to having the highest level of privilege.) If this works successfully, then you should see the following:

Assuming you’ve followed the above steps correctly, you should now be able to browse to the IP of your server in your web browser and see the following after logging in:

Of course we now want to add server(s) into this, so on to the next section we go!

Set up monitoring of server to demonstrate functionality

Now, to add monitoring of an SNMP destination, simply navigate through the Observium GUI to Devices > Add Device and enter the details of the device in question. After adding a device, it takes around 5-10 minutes for graphs to start populating, but once they are, it’ll look something like this:

I’m including a link to a fully functional demo on the Observium website which shows all the different types of graphs available—most of which are automatically populated once SNMP data is received by Observium.

Finally, it’s imperative that you configure cron jobs to perform Observium tasks regularly. These are shown below. You’ll need to make sure that you put these in a file under /etc/cron.d/ as they will not work in a standard crontab.

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


Observium is a powerful historical monitoring tool which can be used for capacity planning, fault diagnosis and general performance analysis. It has (in my opinion) now become a de facto replacement for Cacti which used to be the go-to tool for network capacity monitoring.


Tweaking performance of the Observium poller can be found here, along with detailed installation instructions:
Writing custom agent modules for Observium is possible—See here for an example:
Live Observium Demo:

Keith Rogers is an IT professional with over 10 years’ experience in modern development practices. Currently he works for a broadcasting organization in the DevOps space with a focus on automation. Keith is a regular contributor at Fixate IO.


Leave a Comment

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

Skip to toolbar