Skip to content

HA Server Setup

Environment Credentials

  • Database Name: zabbix
  • Database Username: zabbix
  • Database Password: sp!cyowl42
  • Zabbix Username: Admin
  • Zabbix Password: zabbix

Zabbix Database Setup

  1. Login as root and ensure system is up to date before starting the setup.
    Bash
    apt update && apt dist-upgrade -y
    
  2. Add Zabbix repository
    Bash
    wget https://repo.zabbix.com/zabbix/7.4/release/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.4+ubuntu24.04_all.deb -O /tmp/zabbix-repository.deb
    apt install -y /tmp/zabbix-repository.deb && apt update
    
  3. Install MySQL server and Zabbix scripts.
    Bash
    apt install -y mysql-server zabbix-sql-scripts
    
  4. Secure MySQL server deployment by setting up password validate component, password validation policy, removing anonymous users, disabling remote root login and removing test databases.
    Bash
    mysql_secure_installation
    
  5. Login to mysql-server. Hit enter when asked for a password.
    Bash
    mysql -uroot -p
    
  6. Create initial database for Zabbix with users fo localhost, zabbix servers and with password as sp!cyowl42.
    MySQL
    create database zabbix character set utf8mb4 collate utf8mb4_bin;
    create user zabbix@localhost identified by 'sp!cyowl42';
    grant all privileges on zabbix.* to zabbix@localhost;
    create user zabbix@zbsrv1.aadya.tech identified by 'sp!cyowl42';
    grant all privileges on zabbix.* to zabbix@zbsrv1.aadya.tech;
    create user zabbix@zbsrv2.aadya.tech identified by 'sp!cyowl42';
    grant all privileges on zabbix.* to zabbix@zbsrv1.aadya.tech;
    set global log_bin_trust_function_creators = 1;
    quit;
    
  7. Use zabbix@localhost user created in the previous step to import schemas for the database that's just created. Use the same password as used before.
    Bash
    zcat /usr/share/zabbix/sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
    
  8. Login to mysql-server as root and disable log_bin_trust_function_creators option after importing database schema.
    MySQL
    set global log_bin_trust_function_creators = 0;
    quit;
    
  9. Enable mysql to be accessible on all interfaces and restart mysql-server
    /etc/mysql/mysql.conf.d/mysqld.cnf
    bind-address            = 0.0.0.0
    mysqlx-bind-address     = 0.0.0.0
    

Zabbix Server Setup

  1. On both the systems login as root and ensure system is up to date before starting the setup.
    Bash
    apt update && apt dist-upgrade -y
    
  2. Fix locale
    Bash
    locale-gen "en_US.UTF-8"
    
  3. Add Zabbix repository.
    Bash
    wget https://repo.zabbix.com/zabbix/7.4/release/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.4+ubuntu24.04_all.deb -O /tmp/zabbix-repository.deb
    apt install -y /tmp/zabbix-repository.deb && apt update
    
  4. Install Zabbix server, frontend, agent2.
    Bash
    apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-agent2 
    
  5. Configure the database for Zabbix server and enable reporting by editing /etc/zabbix/zabbix_server.conf
    • DBHost=zbdb.aadya.tech
    • DBPassword=sp!cyowl42
    • StartReportWriters=3
    • WebServiceURL=http://localhost:10053/report
    • HANodeName=zbsrv1
    • NodeAddress=zbsrv1.aadya.tech
  6. Enable nginx to load zabbix-server
    Bash
    rm -rfv /etc/nginx/sites-enabled/default
    ln -s /etc/zabbix/nginx.conf /etc/nginx/sites-enabled/nginx.conf
    
  7. Restart and enable autostart for Zabbix server and agent processes.
    Bash
    systemctl restart zabbix-server zabbix-agent2 nginx php8.3-fpm
    systemctl enable --now zabbix-server zabbix-agent2 nginx php8.3-fpm
    
  8. Repeat steps 1-7 on zbsrv2, but with HANodeName=zbsrv2 and NodeAddress=zbsrv2.aadya.tech in /etc/zabbix/zabbix_server.conf
  9. Open Zabbix UI web page at default http://zbsrv1.aadya.tech and go through initial configuration.
    • Database type: MySQL
    • Database host: zbdb.aadya.tech
    • Database port: 0
    • Database name: zabbix
    • User: zabbix
    • Password: sp!cyowl42
    • Zabbix server name: Aadya Monitoring
    • Default time zone: (UTC-04:00) America/New_York
  10. This generates Zabbix web configuration on zbsrv1. Either repeat step 9 or copy /etc/zabbix/web/zabbix.conf.php from zbsrv1 to zbsrv2.

Fine Tuning

More than 75% used in the configuration cache

On every Zabbix server and proxy, there is a shared memory for storing host, item, and trigger data. As you add more hosts, items, and triggers to your server, you’ll eventually have to increase the size of this memory so that you won’t face any problems with your server’s performance.

If you get the alert Zabbix server: More than 75% used in the configuration cache. then update CacheSize from the default value of 32M to higher value and then restart zabbix-server.

In Zabbix, “trends” are a type of data storage representing aggregated historical data. Zabbix monitors and collects a vast amount of data from various sources, which can quickly become large and cumbersome to manage and analyze. To efficiently handle this, Zabbix uses two primary types of historical data storage: History and Trends.

The primary purpose of Trends is to reduce storage requirements and improve the performance of long-term data analysis and visualization. By storing trends, Zabbix allows users to maintain historical performance and status information over extended periods (months or even years) without overwhelming the database with detailed history records.

The message Zabbix server: More than 75% used in the trends cache from your Zabbix monitoring system indicates that the trends cache size is nearing or exceeding its configured maximum limit, which can impact performance.

This issue arises when the trends cache, which stores trend data before it is written to the database, fills up due to high data input rates or insufficient flushing.

Update the default value of 16M to 32M and then restart zabbix-server.

Value cache is fully used: Please increase ValueCacheSize configuration parameter

To make the calculation of trigger expressions, calculated items and some macros much faster, a value cache option is supported by the Zabbix server.

This in-memory cache can be used for accessing historical data, instead of making direct SQL calls to the database. If historical values are not present in the cache, the missing values are requested from the database and the cache updated accordingly. Update the default value of 8M to higher value and then restart zabbix-server.