Install and Configure Observium on RHEL/CentOS 7
Install and Configure Observium on RHEL/CentOS 7
Docs link:https://docs.observium.org/install_rhel/#rhel-centos-7
We used updated software and required packages
Let,s Start
Introduction
This guide will show you how to perform an Observium installation on an CentOS/RHEL/
We first install Webtatic, OpenNMS, and EPEL repositories on CentOS 7 / RHEL 7.
Repositories
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
Packages
Install yum-utils and switch to REMI's PHP 7.3 packages
yum install yum-utils
yum-config-manager --enable remi-php73
Update all installed packages
yum update
Now let's install the needed packages for Observium:
yum install wget httpd php php-opcache php-mysql php-gd php-posix php-mcrypt net-snmp net-snmp-utils fping MySQL-python rrdtool subversion jwhois ipmitool graphviz ImageMagick php-pear cronie
optionals packages:
pear install Net_IPv4-1.3.4
pear install Net_IPv6-1.2.2b2
Installing MariaDB Server 10.4
To deploy MariaDB Community Server 10.4 on RHEL 7 or CentOS 7, first download and use the mariadb_repo_setup
script to configure the MariaDB repositories for YUM:
$ wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup $ chmod +x mariadb_repo_setup $ sudo ./mariadb_repo_setup
To install MariaDB Community Server and dependencies:
sudo yum install MariaDB-server MariaDB-backup
verify version
php -v
mysql -V
Installation and Configuration Steps Observium Server:
Download Observium
First, create a directory for Observium to live in:
mkdir -p /opt/observium && cd /opt
Observium 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
MySQL Database
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 'password'
SHOW GLOBAL VARIABLES LIKE 'version';
Create the MySQL database:
mysql -u root -p
CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'observium
'@'localhost' IDENTIFIED BY
'password';
GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost'
;
FLUSH PRIVILEGES;
exit;
SELinux
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:
setenforce 0
open ‘/etc/sysconfig/selinux‘ file and change the option from ‘permissive‘ to ‘disabled‘.
nano /etc/sysconfig/selinux
SELINUX=permissive
TO
SELINUX=disabled
Observium Configuration
Change into the new install directory:
cd observium
Copy the default configuration file and edit it for your system:
cp config.php.default config.php
You must change the MySQL username and password
// Database config
$config['db_host'] = 'localhost';
$config['db_user'] = 'observium';
$config['db_pass'] = 'password';
$config['db_name'] = 'observium';
Cd /opt/observium
./discovery.php -u
Insert MySQL Schema
Run the discovery.php script with the upgrade switch -u
in order
to insert the initial MySQL schema
./discovery.php -u
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Fping
Since Fping is in a different location, add a line to config.php to tell Observium.
[root@
ipcon]# which fping
/sbin/fping
Add the following under nano/opt/observium/config.php
$config['fping'] = "/sbin/fping";
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
System
Create the rrd directory to store RRDs in:
chown apache:apache rrd
Configure Apache for Observium
Create a ‘rrd‘ directory under ‘/opt/observium‘ directory for storing RRD’s.
cd /opt/observium
mkdir rrd
Next, grant Apache ownership to ‘rrd‘ directory to write and store RRD’s under this directory.
chown -R apache:apache rrd
To maintain observium logs, create a ‘logs‘ directory for Apache under ‘/opt/observium‘ and apply Apache ownership to write logs.
mkdir /opt/observium/logs
chown apache:apache /opt/observium/logs
Create a Apache Virtual Host directive for Obervium in ‘/etc/httpd/conf.d/httpd.conf‘ file.
nano /etc/httpd/conf.d/observium.conf
Add the following Virtual Host directive at the bottom of the file and enable Virtualhost section as shown in the screenshot below.
Default port 80 I made change 80 to 8008 fo apache web server
<VirtualHost *:8008>
DocumentRoot /opt/observium/html/
ServerName IP_ADDRESS_OF_OBSERVIUM
CustomLog /opt/observium/logs/access_log combined
ErrorLog /opt/observium/logs/error_log
AllowEncodedSlashes NoDecode
<Directory "/opt/observium/html/">
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
Set time zone in php.ini file.
For CentOS / RHEL: /etc/php.ini
After all settings, restart Apache service.
service httpd restart
Add a first user, use level of 10 for admin:
cd /opt/observium
./adduser.php <username> <password> <level
>
i.e
./adduser.php
admin
admin@123 10
Configure snmpd
cp /opt/
observium
/snmpd.conf.example /etc/snmp/snmpd.conf
vi /etc/snmp/snmpd.conf
Cron
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 >> /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
Final Points
Let's set the httpd to startup when we reboot the server:
systemctl enable httpd
systemctl start httpd
and
chkconfig mysqld on
chkconfig httpd on
Permit HTTP through the server's default firewall
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --add-port=80
08/tcp --permanent
firewall-cmd --reload
Add a first device to monitor:
./add_device.php 192.168.88.126 observium v2c
Do an initial discovery and polling run to populate the data for the new device:
./discovery.php -h all
./poller.php -h all
Comments
Post a Comment