Skip to content
Learni
View all tutorials
DevOps

How to Configure Zabbix to Monitor Your Servers in 2026

18 minINTERMEDIATE
Lire en français

Introduction

Zabbix is an open source monitoring and alerting solution that supervises servers, networks, and applications in real time. In 2026, with the growing complexity of hybrid infrastructures, mastering Zabbix is essential to anticipate failures and optimize performance. This intermediate tutorial guides you through a professional Docker deployment, agent configuration, and custom template creation. You will learn to collect precise metrics while avoiding common overload pitfalls. Each step includes concrete, functional examples for immediate implementation.

Prerequisites

  • Linux server (Ubuntu 22.04 or Debian 12)
  • Docker and Docker Compose installed
  • Root or sudo access
  • Basic knowledge of YAML and command line
  • PostgreSQL database (optional for production)

Installation via Docker Compose

docker-compose.yml
version: '3.8'
services:
  zabbix-server:
    image: zabbix/zabbix-server-pgsql:6.4-latest
    ports:
      - "10051:10051"
    environment:
      - DB_SERVER_HOST=zabbix-db
      - POSTGRES_USER=zabbix
      - POSTGRES_PASSWORD=StrongPass2026
    depends_on:
      - zabbix-db
  zabbix-web:
    image: zabbix/zabbix-web-nginx-pgsql:6.4-latest
    ports:
      - "8080:8080"
    environment:
      - ZBX_SERVER_HOST=zabbix-server
      - DB_SERVER_HOST=zabbix-db
  zabbix-db:
    image: postgres:15
    environment:
      - POSTGRES_USER=zabbix
      - POSTGRES_PASSWORD=StrongPass2026
      - POSTGRES_DB=zabbix

This docker-compose file deploys Zabbix Server, the web interface, and PostgreSQL. The environment variables ensure a secure connection between the services.

Starting the Container

terminal
docker compose up -d
# Wait 60 seconds for initialization
sleep 60
# Check the logs
docker compose logs -f zabbix-server

This command starts the services in the background. The delay allows the database to initialize before the Zabbix server attempts to connect.

Zabbix Agent Configuration

zabbix_agentd.conf
Server=192.168.1.100
ServerActive=192.168.1.100
Hostname=web-server-01
ListenPort=10050
StartAgents=3
RefreshActiveChecks=60
BufferSend=5
BufferSize=100

This file configures the agent to communicate with the Zabbix server. The BufferSend and BufferSize parameters optimize metric transmission in case of network latency.

Installing the Agent on a Host

install-agent.sh
#!/bin/bash
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
sudo dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb
sudo apt update
sudo apt install zabbix-agent
sudo cp zabbix_agentd.conf /etc/zabbix/
sudo systemctl enable --now zabbix-agent

This script installs and configures the Zabbix agent on an Ubuntu server. It enables the service for automatic startup after each reboot.

Custom Template in JSON

custom-template.json
{
  "zabbix_export": {
    "version": "6.4",
    "templates": [{
      "template": "Custom Linux Metrics",
      "groups": [{"name": "Templates"}],
      "items": [{
        "name": "CPU Load 5min",
        "key": "system.cpu.load[all,avg5]",
        "type": 0,
        "value_type": 0
      }]
    }]
  }
}

This JSON file defines a template with a CPU item. Import it via the web interface to quickly reuse configurations across multiple hosts.

Best Practices

  • Always use official templates before creating custom items
  • Configure triggers with thresholds suited to your environment
  • Enable TLS encryption between agents and server
  • Limit user permissions using RBAC roles
  • Monitor database size with hourly partitions

Common Errors to Avoid

  • Forgetting to open port 10051 on the server firewall
  • Using weak passwords for the PostgreSQL database
  • Not enabling active checks on remote agents
  • Ignoring minor updates that fix memory leaks

Going Further

Explore the Zabbix API to automate host creation and discover our Learni training courses on advanced monitoring.