This page looks best with JavaScript enabled

Zabbix installation with PostgreSQL database

 ·  ☕ 2 min read

Zabbix is an open-source monitoring software tool for diverse IT components, including networks, servers, virtual machines (VMs) and cloud services. Zabbix provides monitoring metrics, among others network utilization, CPU load and disk space consumption.
Read more at zabbix.com.

Installation

  • Install PostegreSQL:

    sudo apt install postgresql postgresql-contrib
    
  • Install Apache:

    sudo apt install apache2 apache2-utils
    
  • Install Zabbix:

    sudo apt install zabbix-server-pgsql zabbix-frontend-php
    
  • Install Certbot:

    sudo apt install certbot python3-certbot-nginx python3-certbot-apache
    

PostgreSQL configuration

  • Create database user:

    sudo -u postgres createuser --pwprompt zabbix
    
  • Create database for Zabbix:

    sudo -u postgres createdb -O zabbix -E Unicode -T template0 zabbix
    
  • Configure database:

    zcat /usr/share/zabbix-server-pgsql/schema.sql.gz | sudo -u zabbix psql zabbix
    zcat /usr/share/zabbix-server-pgsql/images.sql.gz | sudo -u zabbix psql zabbix
    zcat /usr/share/zabbix-server-pgsql/data.sql.gz | sudo -u zabbix psql zabbix
    

Zabbix configuration

  • Configure access to database in /etc/zabbix/zabbix_server.conf:

    DBHost=<host>
    DBName=zabbix
    DBUser=zabbix
    DBPassword=<password>
    
  • Enable and start service:

    sudo systemctl enable zabbix-server
    sudo systemctl start zabbix-server
    

Apache configuration

  • Set which ports to by Apache in /etc/apache2/ports.conf.

  • Open desired port(s):

    firewall-cmd --permanent --zone=public --add-port=8880/tcp
    firewall-cmd --reload
    
  • Disable server info by changing following parameters in /etc/apache2/conf-enabled/security.conf:

    ServerTokens Prod
    ServerSignature Off
    
  • Enable Zabbix configuration file in Apache:

    cp /etc/apache2/conf-available/zabbix-frontend-php.conf /etc/apache2/conf-enabled/zabbix.conf
    
  • Set timezone for Zabbix in /etc/apache2/conf-enabled/zabbix.conf.

  • Enable and start Apache:

    sudo systemctl enable apache2
    sudo systemctl start apache2
    

Nginx configuration (optional)

  • If your server behind Nginx proxy, configure it too:
    server {
       server_name zabbix.example.com;
       location / {
          include /etc/nginx/proxy_params;
          proxy_pass          http://localhost:8880;
          proxy_read_timeout  90s;
          proxy_redirect      http://localhost:8880 https://zabbix.example.com;
       }
    }
    

HTTPS configuration

  • Just run certbot and answer it’s questions.
  • Restart your webserver.

Finish Zabbix configuration

Go to zabbix.example.com/zabbix and finish configuration. Default login/password is Admin/zabbix. At the end, you will need to download and save the configuration file on a server manually.
That’s all!


Vladislav Pashinskikh
WRITTEN BY
Vladislav Pashinskikh
DevOps Engineer from Ukraine