Install Observium on Ubuntu 22.04

Install Observium pada Ubuntu 22.04

Add Device Host (Linux and Windows) on Observium


  • Update repository ubuntu
apt update && apt upgrade -y
  • Setting time zone
timedatectl set-timezone Asia/Jakarta

Install LNMP

  • Install Nginx
add-apt-repository ppa:ondrej/nginx -y && apt update
apt install nginx nginx-core nginx-full -y
  • Install MariaDB 10.8
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.8
apt install mariadb-server mariadb-client -y
mysql_secure_installation

   Enter current password for root (enter for none):  <enter>
   Switch to unix_socket authentication [Y/n] n
   Change the root password? [Y/n] Y
   Remove anonymous users? [Y/n] Y
   Disallow root login remotely? [Y/n] Y
   Remove test database and access to it? [Y/n] Y
   Reload privilege tables now? [Y/n] Y
  • Install PHP 8.1
apt install software-properties-common -y
add-apt-repository ppa:ondrej/php && apt update
apt install -y php8.1 php8.1-{common,cli,gd,curl,mysql,xml,mbstring,zip,ldap,xmlrpc,curl,intl,fpm,imagick,dev,imap,opcache,soap,memcached,redis}

Setting Database

  • Disable strict mode tambahkan dibawah bari [mysqld]
nano /etc/mysql/mariadb.conf.d/50-server.cnf

   [mysqld]
   innodb_file_per_table=1
   sql-mode=""
   lower_case_table_names=0
  • Restart service mariadb
systemctl restart mariadb
  • Tambahkan database baru untuk Observium
mysql -u root -p

CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'observium'@'localhost' IDENTIFIED BY 'P@ssw0rd!';
GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost' IDENTIFIED BY 'P@ssw0rd!';
FLUSH PRIVILEGES;
exit

Setting PHP.ini

  • Enable service php-fpm
systemctl enable --now php8.1-fpm
  • Edit php.ini
nano /etc/php/8.1/fpm/php.ini

   memory_limit = 512M
   max_execution_time = 300
   max_input_time = 300
   date.timezone = Asia/Jakarta
  • Restart service nginx dan php-fpm
systemctl restart nginx
systemctl restart php8.1-fpm

Download dan Install Observium

  • Buat user observium
useradd -r -M -d /opt/observium observium
usermod -a -G observium www-data
  • Install requirement packages
apt update && apt install -y rrdtool whois fping imagemagick graphviz mtr-tiny nmap python3-mysqldb snmp snmpd python3-memcache mtr-tiny acl
  • Download Observium
wget http://www.observium.org/observium-community-latest.tar.gz
tar xvf observium-community-latest.tar.gz
mv observium /opt
cp /opt/observium/config.php.default /opt/observium/config.php
  • Edit file koneksi database
nano /opt/observium/config.php
// Database config
// --- This MUST be configured
$config['db_host']      = 'localhost';
$config['db_name']      = 'observium';
$config['db_user']      = 'observium';
$config['db_pass']      = 'P@ssw0rd!';
  • Buat directory rrd dan logs
mkdir /opt/observium/{rrd,logs}
chown -R observium:observium /opt/observium/
chmod -R 775 /opt/observium/
  • Setting snmpd, tambahkan rocommunity string snmp menjadi observium
cp /opt/observium/snmpd.conf.example /etc/snmp/snmpd.conf
nano /etc/snmp/snmpd.conf

   #  Default access to full view
   rocommunity observium  default    -V all
  • Restart service snmpd
systemctl restart snmpd

Setting PHP-FPM

  • Copy file www.conf
cp /etc/php/8.1/fpm/pool.d/www.conf /etc/php/8.1/fpm/pool.d/observium.conf
  • Edit file /etc/php/8.1/fpm/pool.d/observium.conf
nano /etc/php/8.1/fpm/pool.d/observium.conf

# ganti [www] menjadi [observium]

# ganti user dari www-data menjadi librenms
user = observium
group = observium

# ganti socket php-fpm
listen = /run/php/php8.1-fpm-observium.sock

# Ganti value berikut
pm.process_idle_timeout = 30s;
pm.max_children = 10
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 100

Setting Virtual Host Nginx

  • Edit file /etc/nginx/conf.d/observium.conf
nano /etc/nginx/conf.d/observium.conf
  • Domain yang digunakan observium.sys-ops.id , jika tidak mempunyai domain bisa menggunakan IP address
server {
 listen      80;
 server_name observium.sys-ops.id;
 root        /opt/observium/html;
 index       index.php;

 charset utf-8;
 gzip on;
 gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
 location / {
  try_files $uri $uri/ /index.php?$query_string;
 }
 location ~ [^/]\.php(/|$) {
  fastcgi_pass unix:/run/php/php8.1-fpm-observium.sock;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  include fastcgi.conf;
  fastcgi_index index.php;
  include fastcgi_params;
  fastcgi_read_timeout 300;
  proxy_read_timeout 600;
 }
 location ~ /\.(?!well-known).* {
  deny all;
 }
}
  • Verifikasi nginx, pastikan tidak ada error
nginx -t

   nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
   nginx: configuration file /etc/nginx/nginx.conf test is successful
  • Hapus default site dan restart service nginx dan php-fpm
rm -rf /etc/nginx/sites-enabled/default
systemctl restart nginx
systemctl restart php8.1-fpm

Setting Observium Web UI

  • Import MySQL scheme
cd /opt/observium && sudo ./discovery.php -u

<output>
  ___   _                              _
 / _ \ | |__   ___   ___  _ __ __   __(_) _   _  _ __ ___
| | | || '_ \ / __| / _ \| '__|\ \ / /| || | | || '_ ` _ \
| |_| || |_) |\__ \|  __/| |    \ V / | || |_| || | | | | |
 \___/ |_.__/ |___/ \___||_|     \_/  |_| \__,_||_| |_| |_|
                     Observium Community Edition 22.5.12042
                                  https://www.observium.org

Install initial database schema ... done.
-- Updating database/file schema
416 -> 417 # (db) .. Done (0s).
417 -> 418 # (db) . Done (0s).
418 -> 419 # (db) .... Done (1s).
419 -> 420 # (db) .. Done (0s).
420 -> 421 # (db) ... Done (0s).
421 -> 422 # (db) .. Done (0s).
422 -> 423 # (db) ...... Done (1s).
423 -> 424 # (php)  Done (0s).
424 -> 425 # (db) . Done (0s).
425 -> 426 # (db) ............... Done (1s).
426 -> 427 # (db) ... Done (1s).
427 -> 428 # (db) ... Done (0s).
428 -> 429 # (db) ... Done (1s).
429 -> 430 # (db) (WARNING! Required MySQL version 5.6+ or MariaDB 10.0+).... Done (0s).
430 -> 431 # (db) ..... Done (0s).
... 
-- Done.
  • Tambahkan admin user
cd /opt/observium/
sudo ./adduser.php admin P@ssw0rd! 10

<output>
Observium CE 22.5.12042
Add User
User admin added successfully.
  • Akses level
0 - Disabled (This user disabled)
1 - Normal User (This user has read access to individual entities)
5 - Global Read (This user has global read access)
7 - Global Secure Read (This user has global read access with secured info)
8 - Global Secure Read / Limited Write (This user has secure global read access with scheduled maintenence read/write.)
10 - Administrator (This user has full administrative access)
  • Akses Observium Web UI dengan domain: http://observium.sys-ops.id atau bisa dengan IP address
  • Tampilan dashboard Observium
  • Tambahkan device host server observium (localhost device)
  • Devices > Add Device > hostname: localhost > Protocol: v2c > Transport: UDP > Port: 161> Timeout: 10 > Retries: 5 > SNMP Community: observium > Add device
  • Tampilan detail monitoring host
  • Jika terdapat error “device not pulled atau device not discovered” jalankan perintah berikut:
cd /opt/observium/
./poller.php -h localhost -d
./discovery.php -h localhost -d

herdiana3389

A system administrator with skills in system administration, virtualization, linux, windows, networking, cloud computing, container, etc.