Skip to content

Deployment Overview of Zabbix Proxy on Server

Prerequisites and Basic Requirements

The deployment requires a server running Ubuntu 22.04. The following system packages must be present to facilitate the installation and operation of the Zabbix Proxy: - ca-certificates - curl - gnupg - apt-transport-https

The installation process utilizes the official Zabbix repository. The specific version of the Zabbix Proxy is determined by the zabbix-release package installed from the repository.

File and Directory Structure

The application utilizes the following directory structure for configuration, data, and certificates: - Configuration Directory: /etc/zabbix/ contains the main proxy configuration file zabbix_proxy.conf. - Data Directory: /var/lib/zabbix/ stores the SQLite database file (if using SQLite backend) or acts as the data directory for the proxy. - Nginx Configuration: /data/nginx/user_conf.d/ holds custom Nginx configuration files for the proxy server. - Nginx Compose Directory: /root/nginx/ contains the compose.yml file used to orchestrate the Nginx and Certbot containers. - SSL Certificates: /etc/letsencrypt/ is mounted to store SSL certificates managed by Certbot.

Application Installation Process

The Zabbix Proxy is installed using the native package manager (apt) based on the selected database backend. The installation steps are as follows:

  1. Add Zabbix Repository: The system adds the Zabbix repository and installs the zabbix-release package corresponding to the target version.
  2. Install Proxy Package: Depending on the backend configuration, one of the following packages is installed:
    • zabbix-proxy-sqlite3 and zabbix-sql-scripts for SQLite.
    • zabbix-proxy-mysql for MySQL.
    • zabbix-proxy-pgsql for PostgreSQL.
  3. Configure Database:
    • For SQLite: The DBName parameter in /etc/zabbix/zabbix_proxy.conf is set to /var/lib/zabbix/zabbix_proxy.db.
    • For MySQL/PostgreSQL: The DBName, DBUser, DBPassword, and DBHost parameters are configured in /etc/zabbix/zabbix_proxy.conf to point to the external database server.
  4. Set Common Parameters: The Server and Hostname parameters are defined in the configuration file to identify the proxy and its connection target.

Databases

The Zabbix Proxy supports three database backends, configured via the zabbix_proxy.conf file: - SQLite: The database is stored locally as a file at /var/lib/zabbix/zabbix_proxy.db. The directory /var/lib/zabbix is owned by the zabbix user and group with 0750 permissions. - MySQL: Connection details including host, database name, user, and password are specified in the configuration file. - PostgreSQL: Connection details including host, database name, user, and password are specified in the configuration file.

Proxy Servers

A reverse proxy is deployed using Docker to handle SSL termination and traffic routing. The proxy setup includes: - Nginx Container: Runs the jonasal/nginx-certbot:latest image. - Certbot Integration: Automatically manages SSL certificates for the domain. - Configuration: Custom Nginx configuration is located in /data/nginx/user_conf.d/. The proxy is configured to forward traffic to the Zabbix Proxy running locally on port 8083 via the directive proxy_pass http://127.0.0.1:8083;. - Environment: The container uses an environment file located at /data/nginx/nginx-certbot.env and sets the CERTBOT_EMAIL to [email protected]. - Volumes: The container mounts the nginx_secrets volume to /etc/letsencrypt for certificate storage and maps /data/nginx/user_conf.d to /etc/nginx/user_conf.d inside the container.

Docker Containers and Their Deployment

The Nginx and Certbot services are managed via Docker Compose. The deployment involves the following: - Compose File: The orchestration file is located at /root/nginx/compose.yml. - Service Definition: The nginx service is defined with network_mode: host and set to restart: unless-stopped. - Execution: The services are started using the command docker compose up -d executed from the /root/nginx directory.

Starting, Stopping, and Updating

The Zabbix Proxy service is managed using the standard system service manager. The following commands are used to control the service: - Start and Enable: The service is enabled to start on boot and started immediately using the zabbix-proxy service name. - Restart: To apply configuration changes, the service is restarted using the zabbix-proxy service name.

The Docker-based Nginx proxy is managed via Docker Compose commands executed in the /root/nginx directory.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×