This guide will show you how to perform an Observium installation on an CentOS/RHEL/Scientific Linux (referred to collectively as Enterprise Linux or EL) release 7 system.
In this example, we use and recommend a clean installation of EL 7.
If you need to install SSH to install remotely, this can be installed via YUM:
yum install openssh
Then you can start the SSH server and add it to system startup
systemctl enable sshd systemctl start sshd
For more extended packagelist, we first install the REMI, OpenNMS and EPEL repositories:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install http://yum.opennms.org/repofiles/opennms-repo-stable-rhel7.noarch.rpm yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Update and Install Packages¶
yum install yum-utils
Enable PHP 7.2 from the REMI repository as default
yum-config-manager --enable remi-php72
Update all installed packages
Now let's install the needed packages for Observium:
yum install wget.x86_64 httpd.x86_64 php.x86_64 php-opcache.x86_64 php-mysql.x86_64 php-gd.x86_64 \ php-posix php-pear.noarch cronie.x86_64 net-snmp.x86_64 net-snmp-utils.x86_64 \ fping.x86_64 mariadb-server.x86_64 mariadb.x86_64 MySQL-python.x86_64 rrdtool.x86_64 \ subversion.x86_64 jwhois.x86_64 ipmitool.x86_64 graphviz.x86_64 ImageMagick.x86_64 \ php-sodium.x86_64
If you want to be able to monitor libvirt virtual machines, install libvirt:
yum install libvirt.x86_64
First, create a directory for Observium to live in:
mkdir -p /opt/observium && cd /opt
Observium comes in two editions, an Open Source Community Edition released on a biannual cycle, and a Subscription Edition with additional features, rapid bug fixes and feature improvements on a daily basis and an easy to use SVN-based update mechanism.
Observium Community Edition¶
If you would like to install the Community Edition, please install using the most recent .tar.gz release.
Download the latest .tar.gz of Observium and unpack:
wget http://www.observium.org/observium-community-latest.tar.gz tar zxvf observium-community-latest.tar.gz
Observium Subscription Edition¶
If you have a valid Observium subscription, please use one of the automated SVN release repositories.
We recommend the
stable train for people who intend to use automated updates to keep their Observium installation up to date.
svn co http://svn.observium.org/svn/observium/trunk observium
svn co http://svn.observium.org/svn/observium/branches/stable observium
Start MySQL/MariaDB and configure it to be run at startup.
systemctl enable mariadb systemctl start mariadb
Set the MySQL root password:
/usr/bin/mysqladmin -u root password '<mysql root password>'
Create the 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>'; mysql> exit;
Change into the new install directory:
Copy the default configuration file and edit it for your system:
cp config.php.default config.php
Edit config.php. Change the options to reflect your installation.
You must change the MySQL username and password contained in
db_pass. Most other settings can be left as default.
Insert MySQL Schema¶
Run the discovery.php script with the upgrade switch
-u in order to insert the initial MySQL schema
It is OK to have some errors in the SQL revisions
Since Fping is in a different location, add a line to config.php to tell Observium.
[root@observium-centos observium]# which fping /sbin/fping
Add the following
$config['fping'] = "/sbin/fping";
Explaining SELinux and how to make Observium work within it is beyond the scope of this guide, so we will disable it. If you are competent enough to maintain SELinux, then that is possible too, but is an even more unsupported configuration than RHEL/CentOS themselves.
Firstly, disable SELinux. You can do this temporarily with the following command:
We need to disable SELinux permanently, so you also need to change
/etc/selinux/config so that the
SELINUX option is set to permissive
Create the rrd directory to store RRDs in:
mkdir rrd chown apache:apache rrd
If the server will be running only Observium, change /etc/httpd/conf.d/observium.conf and add the following to the end :
<VirtualHost *> 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 Require all granted </Directory> </VirtualHost>
Create logs directory for apache
mkdir /opt/observium/logs chown apache:apache /opt/observium/logs
Add a first user, use level of 10 for admin:
cd /opt/observium ./adduser.php <username> <password> <level>
Add a first device to monitor:
./add_device.php <hostname> <community> v2c
Do an initial discovery and polling run to populate the data for the new device:
./discovery.php -h all ./poller.php -h all
Add cron jobs, create a new file
/etc/cron.d/observium with the following contents:
The below example includes a username, so will only work in /etc/crontab or /etc/cron.d/observium. It will NOT work in a user crontab edited with crontab -e without removing the username.
# 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 >> /dev/null 2>&1 # Run housekeeping script daily for syslog, eventlog and alert log 13 5 * * * root /opt/observium/housekeeping.php -ysel # Run housekeeping script daily for rrds, ports, orphaned entries in the database and performance data 47 4 * * * root /opt/observium/housekeeping.php -yrptb
And reload the cron process:
systemctl reload crond
Please note running four poller instances is good for initial testing, but do check the [[Performance tuning]] page for further performance enhancing options once you get going.
Let's set the httpd to startup when we reboot the server:
systemctl enable httpd systemctl start httpd
Permit HTTP through the server's default firewall
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --reload
You should now be able to see
Updating Observium has been designed to be as quick and painless as possible. Using our SVN delivery mechanism, it can even be automated. Because we have a rapid development and model, we recommend that you update frequently, at least once per month, though once or twice per week is better and many users update daily via an automated CRON job.
See Updating the Subscription Edition for a short explanation on how to update the Subscription Edition of Observium.
When running eg. poller.php or discovery.php a lot of notices regarding undefined indexes, variables and offsets. To hide these notices you can do the following:
Find the line containing:
error_reporting = E_ALL & ~E_DEPRECATED
Change this to:
error_reporting = E_ALL & ~E_NOTICE