How to Install observium in Ubuntu and Debian Linux

 

Install the packages we need to run Observium

For Ubutu and Debian

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


Install observium
Create A Directory
mkdir -p /opt/observium && cd /opt
 

Download latest Version of observium
svn co http://svn.observium.org/svn/observium/branches/stable observium

Configure Observium
cd observium
cp config.php.default config.php

Create MYSQL Database
mysql -u root -p
<mysql root password>
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>';

Setup the MySQL database and insert the default schema

./discovery.php -u

Create Require Directories
mkdir logs
mkdir rrd
chown www-data:www-data rrd

Apache Configure
dpkg -l apache2
/etc/apache2/sites-available/default to

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /opt/observium/html
    <FilesMatch \.php$>
      SetHandler application/x-httpd-php
    </FilesMatch>
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /opt/observium/html/>
            DirectoryIndex index.php
            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>

Enable php mcrypt module
phpenmod mcrypt
a2enmod rewrite
apache2ctl restart

Add a first user, use level of 10 for admin
./adduser.php <username> <password> <level>
./add_device.php <hostname> <community> v2c

Perform Discovery for pull

./discovery.php -h all
./poller.php -h all

Add cron jobs, create a new file /etc/cron.d/observium with the following contents: 

# 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/poller-wrapper.py 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


If you want to create a proper virtual host, something like this: 
<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>

Related posts

One Thought to “How to Install observium in Ubuntu and Debian Linux”

  1. Arafat

    I like your tutorial, You are one of the great ……

Leave a Comment