Configure Zabbix proxy servers to distribute monitoring load across multiple network segments, reduce server load, and monitor remote locations through secure proxy connections.
Prerequisites
- Running Zabbix server installation
- Separate server for proxy deployment
- Network connectivity between proxy and server
- Root or sudo access on proxy server
What this solves
Zabbix proxy servers act as data collectors that forward monitoring information to your main Zabbix server. This setup reduces network traffic, allows monitoring of remote locations behind firewalls, and distributes the monitoring load across multiple servers. You need proxies when monitoring devices across different network segments, remote offices, or when your main server can't directly reach all monitored hosts.
Prerequisites
You need a running Zabbix server installation and a separate server for the proxy. The proxy server should have network access to both the monitored devices and the main Zabbix server. For database requirements, you can use either SQLite (for smaller deployments) or PostgreSQL/MySQL for larger environments.
Step-by-step configuration
Update system packages
Start by updating your package manager to ensure you have the latest security patches and package information.
sudo apt update && sudo apt upgrade -y
Add Zabbix repository
Add the official Zabbix repository to get the latest stable version of Zabbix proxy. This ensures you get security updates and bug fixes directly from the Zabbix team.
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu24.04_all.deb
sudo dpkg -i zabbix-release_7.0-2+ubuntu24.04_all.deb
sudo apt update
Install Zabbix proxy with database
Install the Zabbix proxy package along with your chosen database backend. SQLite is simpler for smaller deployments, while PostgreSQL offers better performance for larger environments.
# For SQLite backend (recommended for smaller deployments)
sudo apt install -y zabbix-proxy-sqlite3
For PostgreSQL backend (recommended for larger deployments)
sudo apt install -y zabbix-proxy-pgsql postgresql postgresql-contrib
Configure database for PostgreSQL (optional)
If you chose PostgreSQL, set up the database and user for the Zabbix proxy. Skip this step if you're using SQLite.
sudo systemctl enable --now postgresql
sudo -u postgres createuser --pwprompt zabbix_proxy
sudo -u postgres createdb -O zabbix_proxy zabbix_proxy
Import the initial schema for PostgreSQL:
zcat /usr/share/zabbix-sql-scripts/postgresql/proxy.sql.gz | sudo -u zabbix_proxy psql zabbix_proxy
Configure Zabbix proxy settings
Edit the main proxy configuration file to set up database connection, server details, and proxy-specific settings. The proxy needs to know how to connect to your Zabbix server and which database to use.
# Proxy mode (0 = active proxy, 1 = passive proxy)
ProxyMode=0
Zabbix server IP address
Server=203.0.113.10
Proxy hostname (must match the name configured in Zabbix server frontend)
Hostname=proxy-office-london
Listen port for passive proxies
ListenPort=10051
Database configuration for SQLite
DBName=/var/lib/zabbix/zabbix_proxy.db
Database configuration for PostgreSQL (uncomment if using PostgreSQL)
DBHost=localhost
DBName=zabbix_proxy
DBUser=zabbix_proxy
DBPassword=your_secure_password
How often proxy retrieves configuration data from server (seconds)
ConfigFrequency=3600
How often proxy sends collected data to server (seconds)
DataSenderFrequency=1
Proxy will keep data for N hours in case of no connectivity with Zabbix server
ProxyOfflineBuffer=1
Enable remote commands from Zabbix server
EnableRemoteCommands=1
Log file location
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=10
DebugLevel=3
PID file
PIDFile=/run/zabbix/zabbix_proxy.pid
Cache settings for better performance
CacheSize=8M
HistoryCacheSize=16M
HistoryIndexCacheSize=4M
TrendCacheSize=4M
ValueCacheSize=8M
Set correct file permissions
Create the SQLite database directory and set appropriate ownership for the zabbix user. This ensures the proxy can read configuration files and write to the database.
sudo mkdir -p /var/lib/zabbix
sudo chown -R zabbix:zabbix /var/lib/zabbix
sudo chown -R zabbix:zabbix /var/log/zabbix
sudo chmod 755 /var/lib/zabbix
sudo chmod 644 /etc/zabbix/zabbix_proxy.conf
Configure firewall rules
Open the necessary ports for Zabbix proxy communication. Port 10051 is for passive proxy mode, and port 10050 is for agent communication.
sudo ufw allow 10051/tcp comment "Zabbix proxy"
sudo ufw allow 10050/tcp comment "Zabbix agent"
sudo ufw reload
Enable and start Zabbix proxy
Start the Zabbix proxy service and enable it to start automatically on system boot. Check the status to ensure it's running properly.
sudo systemctl enable --now zabbix-proxy
sudo systemctl status zabbix-proxy
Register proxy with Zabbix server
Log into your Zabbix server web interface and add the new proxy. Go to Administration → Proxies → Create proxy and configure the following settings:
| Setting | Value | Description |
|---|---|---|
| Proxy name | proxy-office-london | Must match Hostname in proxy config |
| Proxy mode | Active | Proxy connects to server |
| Proxy address | Leave empty for active mode | Not needed for active proxies |
| Description | London office monitoring proxy | Optional description |
Click Add to create the proxy registration.
Configure monitoring zones
Set up host groups and assign them to specific proxies for distributed monitoring. In your Zabbix server interface, go to Configuration → Host groups and create location-specific groups.
London-Office-Servers
London-Office-Network
London-Office-Workstations
When adding hosts to these groups, select the appropriate proxy in the "Monitored by proxy" field. This ensures traffic from those hosts flows through the designated proxy server.
Set up proxy load balancing
For high availability, configure multiple proxies for the same network zone. Create additional proxy servers following the same steps, then distribute hosts between them. Use different proxy names like "proxy-london-01" and "proxy-london-02".
You can also configure proxy failover by setting up backup proxies and switching host assignments when a primary proxy fails.
Verify your setup
Check that your proxy is properly communicating with the Zabbix server and collecting data from monitored hosts.
# Check proxy service status
sudo systemctl status zabbix-proxy
Check proxy logs for errors
sudo tail -f /var/log/zabbix/zabbix_proxy.log
Test database connectivity (SQLite)
sudo -u zabbix sqlite3 /var/lib/zabbix/zabbix_proxy.db ".tables"
Check proxy connectivity to Zabbix server
sudo -u zabbix zabbix_proxy -R config_cache_reload
Monitor proxy performance
sudo netstat -tulpn | grep :1005
In the Zabbix server web interface, go to Administration → Proxies to verify the proxy shows as "Active" with a recent "Last seen" timestamp. Check Reports → System information to see proxy statistics and performance metrics.
Configure proxy database connection
For production environments, properly configure database connections with connection pooling and timeout settings. Edit the proxy configuration to optimize database performance:
# Database connection timeout
DBSocket=/var/run/postgresql
Timeout=30
Connection pooling for PostgreSQL
DBMaxOpenFiles=100
Housekeeping settings
HousekeepingFrequency=1
MaxHousekeeperDelete=5000
Buffer settings for high load
ProxyLocalBuffer=0
ProxyOfflineBuffer=24
Set up distributed monitoring zones
Create logical monitoring zones based on network topology and geographical locations. This approach helps organize your infrastructure and improves monitoring efficiency.
Design monitoring zones
Plan your proxy deployment based on network segments, geographic locations, and security boundaries. Common zone patterns include:
- Geographic zones: Europe-West, Asia-Pacific, Americas-East
- Network zones: DMZ, Internal-LAN, Management-Network
- Environment zones: Production, Staging, Development
- Service zones: Database-Tier, Web-Tier, Application-Tier
Implement zone-based host assignment
Configure automatic host assignment to proxies based on network discovery rules. Set up network discovery to automatically assign newly discovered hosts to the appropriate proxy based on IP ranges or subnet masks.
# London office subnet: 10.1.0.0/24 → proxy-london
New York office subnet: 10.2.0.0/24 → proxy-newyork
DMZ subnet: 192.168.100.0/24 → proxy-dmz
Management subnet: 172.16.0.0/24 → proxy-mgmt
Common issues
| Symptom | Cause | Fix |
|---|---|---|
| Proxy shows as inactive | Network connectivity or firewall | Check port 10051 connectivity: telnet zabbix-server 10051 |
| "Cannot connect to database" | Database permission or path issue | Check ownership: sudo chown zabbix:zabbix /var/lib/zabbix/zabbix_proxy.db |
| High memory usage | Cache sizes too large for system | Reduce CacheSize and HistoryCacheSize in config |
| Data not appearing in server | Proxy hostname mismatch | Ensure Hostname in config matches proxy name in web interface |
| "Permission denied" errors | Incorrect file ownership | Fix ownership: sudo chown -R zabbix:zabbix /var/log/zabbix |
| Proxy stops responding | Database lock or corruption | Restart service: sudo systemctl restart zabbix-proxy |
Performance optimization
For larger deployments, optimize proxy performance by tuning cache settings, database configuration, and system resources. Monitor proxy performance through the Zabbix server interface and adjust settings based on your specific load patterns.
Consider using Prometheus and Grafana monitoring to track proxy performance metrics and set up alerts for proxy health issues. You can also integrate with NGINX monitoring if you're using a reverse proxy in front of your Zabbix infrastructure.
Next steps
- Configure Zabbix API automation with Python scripts for automated host management
- Set up Zabbix distributed monitoring with multiple proxy servers for high availability
- Configure Zabbix SNMP monitoring for network devices through your proxy
- Implement Zabbix high availability clustering for production environments
- Configure custom Zabbix monitoring templates for specialized applications
Running this in production?
Automated install script
Run this to automate the entire setup
#!/usr/bin/env bash
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Configuration variables
ZABBIX_SERVER=""
PROXY_HOSTNAME=""
DATABASE_TYPE="sqlite"
DB_PASSWORD=""
# Usage function
usage() {
echo "Usage: $0 -s ZABBIX_SERVER_IP -h PROXY_HOSTNAME [-d DATABASE_TYPE] [-p DB_PASSWORD]"
echo ""
echo "Options:"
echo " -s Zabbix server IP address (required)"
echo " -h Proxy hostname (required)"
echo " -d Database type: sqlite or postgresql (default: sqlite)"
echo " -p Database password (required if using postgresql)"
echo ""
echo "Example: $0 -s 192.168.1.10 -h proxy-office-london"
echo "Example: $0 -s 192.168.1.10 -h proxy-office-london -d postgresql -p mypassword"
exit 1
}
# Parse command line arguments
while getopts "s:h:d:p:" opt; do
case $opt in
s) ZABBIX_SERVER="$OPTARG" ;;
h) PROXY_HOSTNAME="$OPTARG" ;;
d) DATABASE_TYPE="$OPTARG" ;;
p) DB_PASSWORD="$OPTARG" ;;
*) usage ;;
esac
done
# Check required arguments
if [[ -z "$ZABBIX_SERVER" || -z "$PROXY_HOSTNAME" ]]; then
echo -e "${RED}Error: Zabbix server IP and proxy hostname are required${NC}"
usage
fi
if [[ "$DATABASE_TYPE" == "postgresql" && -z "$DB_PASSWORD" ]]; then
echo -e "${RED}Error: Database password is required when using PostgreSQL${NC}"
usage
fi
# Check if running as root
if [[ $EUID -ne 0 ]]; then
echo -e "${RED}Error: This script must be run as root${NC}"
exit 1
fi
# Cleanup function for rollback
cleanup() {
echo -e "${YELLOW}Cleaning up on error...${NC}"
systemctl stop zabbix-proxy 2>/dev/null || true
if [[ "$DATABASE_TYPE" == "postgresql" ]]; then
systemctl stop postgresql 2>/dev/null || true
fi
}
trap cleanup ERR
# Auto-detect distribution
if [ -f /etc/os-release ]; then
. /etc/os-release
case "$ID" in
ubuntu|debian)
PKG_MGR="apt"
PKG_UPDATE="apt update"
PKG_INSTALL="apt install -y"
PKG_UPGRADE="apt upgrade -y"
DISTRO_FAMILY="debian"
;;
almalinux|rocky|centos|rhel|ol|fedora)
PKG_MGR="dnf"
PKG_UPDATE="dnf update -y"
PKG_INSTALL="dnf install -y"
PKG_UPGRADE="dnf update -y"
DISTRO_FAMILY="rhel"
;;
amzn)
PKG_MGR="yum"
PKG_UPDATE="yum update -y"
PKG_INSTALL="yum install -y"
PKG_UPGRADE="yum update -y"
DISTRO_FAMILY="rhel"
;;
*)
echo -e "${RED}Unsupported distribution: $ID${NC}"
exit 1
;;
esac
else
echo -e "${RED}Cannot detect distribution${NC}"
exit 1
fi
echo -e "${BLUE}Setting up Zabbix Proxy on $PRETTY_NAME${NC}"
# Step 1: Update system packages
echo -e "${GREEN}[1/8] Updating system packages...${NC}"
$PKG_UPDATE
$PKG_UPGRADE
# Step 2: Add Zabbix repository
echo -e "${GREEN}[2/8] Adding Zabbix repository...${NC}"
if [[ "$DISTRO_FAMILY" == "debian" ]]; then
$PKG_INSTALL wget
if [[ "$ID" == "ubuntu" ]]; then
UBUNTU_VERSION=$(lsb_release -rs | cut -d. -f1,2)
wget -q "https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu${UBUNTU_VERSION}_all.deb"
dpkg -i "zabbix-release_7.0-2+ubuntu${UBUNTU_VERSION}_all.deb" || true
else
wget -q "https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-2+debian12_all.deb"
dpkg -i "zabbix-release_7.0-2+debian12_all.deb" || true
fi
apt-get update
else
RHEL_VERSION=$(echo $VERSION_ID | cut -d. -f1)
rpm -Uvh "https://repo.zabbix.com/zabbix/7.0/rhel/${RHEL_VERSION}/x86_64/zabbix-release-7.0-2.el${RHEL_VERSION}.noarch.rpm" || true
$PKG_MGR clean all
$PKG_UPDATE
fi
# Step 3: Install Zabbix proxy
echo -e "${GREEN}[3/8] Installing Zabbix proxy...${NC}"
if [[ "$DATABASE_TYPE" == "sqlite" ]]; then
$PKG_INSTALL zabbix-proxy-sqlite3
else
$PKG_INSTALL zabbix-proxy-pgsql postgresql postgresql-contrib
if [[ "$DISTRO_FAMILY" == "rhel" ]]; then
$PKG_INSTALL postgresql-server
fi
fi
# Step 4: Configure database
if [[ "$DATABASE_TYPE" == "postgresql" ]]; then
echo -e "${GREEN}[4/8] Configuring PostgreSQL database...${NC}"
if [[ "$DISTRO_FAMILY" == "rhel" ]]; then
postgresql-setup --initdb 2>/dev/null || true
fi
systemctl enable postgresql
systemctl start postgresql
# Create database and user
sudo -u postgres psql -c "CREATE USER zabbix_proxy WITH PASSWORD '$DB_PASSWORD';" 2>/dev/null || true
sudo -u postgres createdb -O zabbix_proxy zabbix_proxy 2>/dev/null || true
# Import schema
zcat /usr/share/zabbix-sql-scripts/postgresql/proxy.sql.gz | sudo -u zabbix_proxy psql zabbix_proxy
else
echo -e "${GREEN}[4/8] Configuring SQLite database...${NC}"
mkdir -p /var/lib/zabbix
chown zabbix:zabbix /var/lib/zabbix
chmod 755 /var/lib/zabbix
fi
# Step 5: Configure Zabbix proxy
echo -e "${GREEN}[5/8] Configuring Zabbix proxy...${NC}"
PROXY_CONF="/etc/zabbix/zabbix_proxy.conf"
# Backup original config
cp "$PROXY_CONF" "${PROXY_CONF}.backup"
# Configure proxy settings
cat > "$PROXY_CONF" << EOF
ProxyMode=0
Server=$ZABBIX_SERVER
Hostname=$PROXY_HOSTNAME
ListenPort=10051
EOF
if [[ "$DATABASE_TYPE" == "sqlite" ]]; then
echo "DBName=/var/lib/zabbix/zabbix_proxy.db" >> "$PROXY_CONF"
else
cat >> "$PROXY_CONF" << EOF
DBHost=localhost
DBName=zabbix_proxy
DBUser=zabbix_proxy
DBPassword=$DB_PASSWORD
EOF
fi
cat >> "$PROXY_CONF" << EOF
ConfigFrequency=3600
DataSenderFrequency=1
ProxyOfflineBuffer=1
EnableRemoteCommands=1
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=10
DebugLevel=3
PIDFile=/run/zabbix/zabbix_proxy.pid
CacheSize=8M
HistoryCacheSize=16M
TrendCacheSize=4M
ValueCacheSize=8M
Timeout=4
TrapperTimeout=300
UnreachablePeriod=45
UnavailableDelay=60
UnreachableDelay=15
EOF
chmod 644 "$PROXY_CONF"
chown root:zabbix "$PROXY_CONF"
# Step 6: Set up directories and permissions
echo -e "${GREEN}[6/8] Setting up directories and permissions...${NC}"
mkdir -p /var/log/zabbix /run/zabbix
chown zabbix:zabbix /var/log/zabbix /run/zabbix
chmod 755 /var/log/zabbix /run/zabbix
# Step 7: Configure firewall
echo -e "${GREEN}[7/8] Configuring firewall...${NC}"
if command -v ufw >/dev/null 2>&1; then
ufw allow 10051/tcp
elif command -v firewall-cmd >/dev/null 2>&1; then
firewall-cmd --permanent --add-port=10051/tcp
firewall-cmd --reload
fi
# Step 8: Start and enable services
echo -e "${GREEN}[8/8] Starting Zabbix proxy service...${NC}"
systemctl enable zabbix-proxy
systemctl start zabbix-proxy
# Verification
echo -e "${BLUE}Verifying installation...${NC}"
sleep 5
if systemctl is-active --quiet zabbix-proxy; then
echo -e "${GREEN}✓ Zabbix proxy service is running${NC}"
else
echo -e "${RED}✗ Zabbix proxy service is not running${NC}"
echo "Check logs: journalctl -u zabbix-proxy"
exit 1
fi
if ss -tlnp | grep -q :10051; then
echo -e "${GREEN}✓ Zabbix proxy is listening on port 10051${NC}"
else
echo -e "${RED}✗ Zabbix proxy is not listening on port 10051${NC}"
exit 1
fi
echo -e "${GREEN}Zabbix proxy installation completed successfully!${NC}"
echo -e "${YELLOW}Next steps:${NC}"
echo "1. Add this proxy ($PROXY_HOSTNAME) in your Zabbix server web interface"
echo "2. Assign hosts to this proxy in the Zabbix server"
echo "3. Monitor the proxy status in Administration → Proxies"
echo ""
echo -e "${BLUE}Configuration file: $PROXY_CONF${NC}"
echo -e "${BLUE}Log file: /var/log/zabbix/zabbix_proxy.log${NC}"
Review the script before running. Execute with: bash install.sh