Uploaded by Flavio Leonel

Ubuntu Debian Install - Observium

advertisement
25/09/2020
Ubuntu/Debian Install - Observium
Debian/Ubuntu Installation
Compatible Versions
This guide works with Ubuntu 16.04 and 18.04 and Debian 8 and 9. We
strongly recommend using Ubuntu 18.04.
Automated Installation
Observium has an automated install script for use on Ubuntu and Debian systems.
Using the automated installation script is as easy as downloading it, running it and answering a few simple
questions, start with:
wget http://www.observium.org/observium_installscript.sh
chmod +x observium_installscript.sh
./observium_installscript.sh
Manual Installation
If you'd prefer to do a manual installation, you can follow the manual install guide below.
Install Dependencies
Install the packages we need to run Observium:
Ubuntu 20.04:
apt install libapache2-mod-php7.4 php7.4-cli php7.4-mysql php7.4-mysqli php7.4-gd php7.4-json \
php-pear snmp fping mysql-server mysql-client python3-mysqldb rrdtool subversion whois mtr-tiny \
ipmitool graphviz imagemagick apache2 python3-pymysql python-is-python3
Ubuntu 18.04:
https://docs.observium.org/install_debian/
1/9
25/09/2020
Enable the
Ubuntu/Debian Install - Observium
universe
and
multiverse
repositories first
apt-add-repository universe
apt-add-repository multiverse
apt-get install libapache2-mod-php7.2 php7.2-cli php7.2-mysql php7.2-mysqli php7.2-gd php7.2-json \
php-pear snmp fping mysql-server mysql-client python-mysqldb rrdtool subversion whois mtr-tiny \
ipmitool graphviz imagemagick apache2
Debian 9:
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 mariadb-server mariadb-client python-mysqldb rrdtool subversion whois \
mtr-tiny ipmitool graphviz imagemagick apache2
Ubuntu 16.04 and Debian 8:
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
Optional
If you want to be able to monitor libvirt virtual machines, install libvirt-bin (beware: this pulls in a whole bunch of
dependencies you otherwise probably wouldn't need on your server):
apt-get install libvirt-bin
Download Observium
First, create a directory for Observium to live in:
mkdir -p /opt/observium && cd /opt
Observium Editions
Observium comes in two editions, an Open Source Community
Edition released on a biannual cycle, and a Subscription Edition with
https://docs.observium.org/install_debian/
2/9
25/09/2020
Ubuntu/Debian Install - Observium
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 Editions
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.
For the
current
train:
svn co http://svn.observium.org/svn/observium/trunk observium
For the
stable
train:
svn co http://svn.observium.org/svn/observium/branches/stable 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
Edit config.php. Change the options to reflect your installation.
MySQL Credentials
https://docs.observium.org/install_debian/
3/9
25/09/2020
Ubuntu/Debian Install - Observium
You must change the MySQL username and password. Most other
settings can be left as default.
MySQL Database
Create the MySQL database:
You will see the MySQL version upon logging on to the MySQL monitor with
mysql -u root -p
.
MYSQL 8 (UBUNTU 20.04)
mysql
<mysql
mysql>
mysql>
mysql>
-u root -p
root password>
CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'observium'@'localhost' identified by '<observium db password>';
GRANT ALL ON observium.* TO 'observium'@'localhost';
MYSQL <8 AND MARIADB
mysql
<mysql
mysql>
mysql>
-u root -p
root password>
CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost' IDENTIFIED BY '<db password>';
Setup the MySQL database and insert the default schema:
./discovery.php -u
It is OK to have some errors in the SQL revisions
Create required directories
Create the directory Observium will store its logs in:
mkdir logs
Alternatively you can create a directory somewhere else and point the log_dir directive in the configuration to that
directory.
Create the directory to store RRDs in:
https://docs.observium.org/install_debian/
4/9
25/09/2020
Ubuntu/Debian Install - Observium
mkdir rrd
chown www-data:www-data rrd
Apache Configuration
Ubuntu newer than 14.04 and newer versions of Debian use Apache 2.4. You can check your version of Apache
with the following command:
dpkg -l apache2
Apache 2.2
If you're using Apache 2.2 the server will be running only Observium,
change /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>
Apache 2.4
If you're using Apache 2.4 (Ubuntu 14.04 or newer Debian), you need to use this alternative format :
The required file is now /etc/apache2/sites-available/000-default.conf on some
installations, such as Ubuntu 16.04.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /opt/observium/html
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
https://docs.observium.org/install_debian/
5/9
25/09/2020
Ubuntu/Debian Install - Observium
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /opt/observium/html/>
DirectoryIndex index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerSignature On
</VirtualHost>
Alternatively you can create a vhost just for Observium (see the bottom of the page)
Enable php mcrypt module if it's installed (ignore if it isn't):
phpenmod mcrypt
On newer distros (Ubuntu 16.04 and above), enable PHP and switch to
mpm_prefork
:
a2dismod mpm_event
a2enmod mpm_prefork
a2enmod php7.0
Enable
mod_rewrite
for Observium's URLs:
a2enmod rewrite
apache2ctl restart
Add Initial User and Device
Add a first user, use level of 10 for admin:
./adduser.php <username> <password> <level>
Add a first device to monitor:
./add_device.php <hostname> <community> v2c
Perform Initial Discovery and Poll
Do an initial discovery and polling run to populate the data for the new device:
https://docs.observium.org/install_debian/
6/9
25/09/2020
Ubuntu/Debian Install - Observium
./discovery.php -h all
./poller.php -h all
Add cron jobs, create a new file
/etc/cron.d/observium
with the following contents:
Cron Usage
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.
Polling Interval
Observium operates on a fixed poller frequency of 5 minutes or 300
seconds. The poller-wrapper process must be run at this frequency
will NOT work otherwise.
# 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 >> /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
Poller Performance
Please note running four poller instances is good for initial testing, but do
check the Performance Tuningpage for further performance enhancing
options once you get going.
You should now be able to browser to your server's IP address or hostname and access the Observium web
interface.
https://docs.observium.org/install_debian/
7/9
25/09/2020
Ubuntu/Debian Install - Observium
Updating
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 Editionfor a short explanation on how to update the Subscription Edition of
Observium.
Apache Virtual Host
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>
You'll need to create an
it.
/opt/observium/logs
directory with permissions so that Apache can write to
Debian
If you're using Debian, due to the decision of Debian to no longer ship SNMP MIBs with the distribution, you need
to direct the snmp utilities to use Observium's MIBs in order to suppress some annoying error output.
Remove this line in /etc/snmp/snmp.conf:
mibs :
Replace it with this :
mibs : /opt/observium/mibs/rfc:/opt/observium/mibs/net-snmp
This is one of the many self-imposed Debian issues that make Ubuntu generally a better choice for overall
maintainability.
Problems
https://docs.observium.org/install_debian/
8/9
25/09/2020
Ubuntu/Debian Install - Observium
When running poller.php or discovery.php you may see a lot of notices regarding undefined
indexes, variables and offsets. To hide these notices you can do the following:
nano /etc/php5/cli/php.ini
Find the line containing:
error_reporting = E_ALL & ~E_DEPRECATED
Change this to:
error_reporting = E_ALL & ~E_NOTICE
If there are problems with this installation tutorial, please make sure you've followed the install guide closely,
check the FAQs, then join our IRC channel or Mailing Lists and ask for help.
https://docs.observium.org/install_debian/
9/9
Download