Zabbix Proxy

Ricardo Martin | May 17, 2024 min read

Zabbix Proxy setup

As I mentioned on my previous post, I’ll be covering how to install the zabbix proxy using the official Zabbix Alpine Image docker image and on the server itself, in our case Ubuntu 24.04

This guide assumes that you are capable of deploying a ubuntu server on your own. If not, please follow this guide before proceeding.

Docker

If you don’t know how to install docker and docker compose, please follow this Guide before moving on. Alternatively, you can skip to Server Install

1. Create a new directory

Before we deploy the container, create a new directory that will store the compose file. On my docker server, I have a dedicated directory /opt/Docker/ for all services I deploy using docker-compose. I’m going to create a folder named ZabbixProxy:

mkdir /opt/Docker/ZabbixProxy

2. Create and configure a docker-compose.yaml file

Create a new file named docker-compose.yaml in the previously created folder.

vim docker-compose.yaml

Modify the compose file to reflect your environment!

Add the contents below

version: "3.3"
services:
  zbxproxy:
    container_name: ZbxProxy01
    environment:
      - ZBX_HOSTNAME=ZbxProxy01
      - ZBX_SERVER_HOST=10.0.0.21;10.0.0.22
    ports:
    - 10051:10051
    image: zabbix/zabbix-proxy-sqlite3:alpine-6.4-latest
networks: {}

From within the folder run the docker-compose command to start the container

docker-compose up

If everything worked out correctly, you’ll see the container output receiving the configuration from the server

zbxproxy

Now we can run the same command with -d so the container runs in the background

docker-compose up -d

Server Install

Make sure your servers have a static IP address. Below is the /etc/netplan/*.yaml config I’m using

  • 10.0.0.246: ZbxProxy01
  • 10.0.0.1: Gateway
  • 10.0.0.200: Internal DNS server
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - 10.0.0.246/24
      routes:
        - to: default
          via: 10.0.0.1
      nameservers:
        addresses: [10.0.0.200]
        search: [ns01.rcfmartin.com]

1. Install Zabbix Repository

First we need to download the package using wget

wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu24.04_all.deb

Then we’ll use dpkg to install the packages

sudo dpkg -i zabbix-release_6.4-1+ubuntu24.04_all.deb

Now we need to update the packages to make the tools we nee available

sudo apt update -y

2. Install Zabbix Proxy SQLite

We’ll be using a SQLite database for this example.

sudo apt install -y zabbix-proxy-sqlite3 zabbix-agent

3. Edit the config file

Now we need to edit the config file /etc/zabbix/zabbix_proxy.conf to point to the cluster.

  • Server: The ip address of both zabbix servers separated by a semi-colon
  • Hostname: The hostname of the proxy, in my case ZbxProxy01
  • DBName: Name or path of our sqlite database, in my case /tmp/zxbproxy01.sqlite
  • ConfigFrequency: How often proxy retrieves configuration data from Zabbix Server in seconds. We’ll set this parameter to 100
vim /etc/zabbix/zabbix_proxy.conf

Update the items below

# make sure to include both servers separated by semicolon `;`
Server=10.0.0.21;10.0.0.22
Hostname=ZbxProxy01
DBName=/tmp/zbxproxy01.sqlite
ConfigFrequency=100

Now lets edit the agent config file, /etc/zabbix/zabbix_agentd.conf

Server=10.0.0.21,10.0.0.22
ServerActive=10.0.0.21;10.0.0.22

4. Enable and Start the service

First we’ll enable to service so it restarts after a reboot

sudo systemctl enable zabbix-proxy 
sudo systemctl enable zabbix-agent

Now we can restart the service

sudo systemctl restart zabbix-proxy
sudo systemctl restart zabbix-agent

Add Proxy to Zabbix Frontend

1. Configure Proxy

Go to Administration -> Proxies

admiproxmenu

Create a new proxy.

  • Proxy name: The name of your proxy, in my case ZbxProxy01
  • Proxy Mode: In this case Active
  • Proxy Address: The ip of your server, in my case 10.0.0.246

configproxfrontend

Now if you refres the page, you should see the active proxy

alt text

2. Configure Agent

Now that our proxy is up and running, let’s add the agent. Go to Monitoring -> Hosts and create a new host.

alt text

  • Host Name: The name of your proxy, in my case ZbxProxy01
  • Templates: We need the Proxy template Zabbix proxy health
  • Host groups: In my case I created a new group Zabbix Proxy
  • Interfaces: Select Agent
    • Agent: The ip of your server, in my case 10.0.0.246
    • Connect to: Set to IP
    • Port: Set port to 10050
  • Monitored by proxy: From the dropdown select the proxy itself, in my case ZbxProxy01

alt text

Done! The proxy should now be ready to receive connections

Repeat the steps above to deploy a new zabbix proxy

Next Steps

On the next post of this series, I will be covering the zabbix agent setup. We’re going to install the agent on windows and linux manually.