I will give an example of installing the Observium monitoring system in Ubuntu Server 18.04.
Immediately switch to the root user:
sudo su
Install the necessary components for Observium to work:
apt-get update apt-get install libapache2-mod-php php-cli php-mysql php-mysqli php-gd php-json php-pear snmp fping mysql-server mysql-client python-mysqldb rrdtool subversion whois mtr-tiny ipmitool graphviz imagemagick apache2
Create a directory and download Observium:
mkdir -p /opt/observium && cd /opt wget http://www.observium.org/observium-community-latest.tar.gz tar zxvf observium-community-latest.tar.gz
Connect to MySQL, create the database and user:
mysql -u root -p CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost' IDENTIFIED BY 'password'; exit
Create the configuration file from the example and specify the name of the user created by MySQL and the password in it:
cd /opt/observium cp config.php.default config.php nano /opt/observium/config.php
Import the data into the created database:
./discovery.php -u
Create the missing directories:
mkdir logs mkdir rrd chown www-data:www-data rrd
Create a configuration file for apache2:
nano /etc/apache2/sites-available/observium.conf
Add to it:
<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 Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/observium_error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/observium_access.log combined ServerSignature On </VirtualHost>
Turn off the standard apache2 configuration file and activate the new one, and also activate the necessary modules and restart apache2 to apply the changes:
a2dissite 000-default a2ensite observium a2dismod mpm_event a2enmod mpm_prefork a2enmod rewrite systemctl restart apache2
Add an administrator with a maximum level of rights of 10:
./adduser.php USERNAME PASSWORD 10
You can add a device:
./add_device.php HOST COMMUNITY v2c ./discovery.php -h all ./poller.php -h all
Create a file for periodic tasks:
nano /etc/cron.d/observium
Add to it:
# 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
See also my articles:
Zabbix installation on Ubuntu from distribution packages
Install and configure Cacti