Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 37 ยท Getting Started

Zabbix Architecture: Server, Database, Frontend, Agents and Proxies

Understand every Zabbix component: server, database, web frontend, agent, agent 2, proxy, plus the tools zabbix_get and zabbix_sender, default ports and data flow.

Before you install Zabbix, you should know which pieces exist and how they talk to each other. Most Zabbix problems in real life ("host unavailable", "no data", "server is slow") are solved by knowing which component is responsible.

Zabbix does not run on this site. This lesson describes the real components, and the TryIt blocks are stand-ins that model ports and data flow in Python.

The components

flowchart LR
    subgraph Monitored["Monitored systems"]
        A1["Zabbix agent / agent 2"]
        SNMP["SNMP device"]
    end
    subgraph Remote["Remote site"]
        P["Zabbix proxy"]
        A2["Agent"]
    end
    subgraph Core["Central installation"]
        S["Zabbix server"]
        DB[("Database")]
        W["Web frontend<br/>(PHP + nginx/Apache)"]
    end
    S <-->|"10050 passive / 10051 active"| A1
    S -->|"UDP 161"| SNMP
    A2 <--> P
    P -->|"10051"| S
    S <--> DB
    W <--> DB
    W -.->|"10051 (status, test)"| S

Data flow of a medium Zabbix installation. Ports are defaults.

Zabbix server

zabbix_server is the heart. It runs many internal processes: pollers (ask agents and devices for data), trappers (accept pushed data), preprocessing workers, a history syncer (writes to the database), a housekeeper (deletes old data), an alerter (sends notifications), and more. The server evaluates triggers every time a new value arrives, creates problems, and runs actions. It reads its settings from /etc/zabbix/zabbix_server.conf.

Database

All configuration and all collected data live in the database. Supported back ends include MySQL/MariaDB and PostgreSQL (optionally with the TimescaleDB extension for large installations). The server and the frontend both connect to it. When a Zabbix installation is slow, the database is the most common cause, so it deserves fast storage and enough memory.

Web frontend

A PHP application served by nginx or Apache. It talks directly to the database for configuration and display, and to the server on port 10051 for a few functions (showing server status, executing scripts, testing items). Users, permissions, dashboards and maps all live here. It also exposes the JSON-RPC API at /api_jsonrpc.php.

Agent and agent 2

The Zabbix agent (zabbix_agentd, C) and Zabbix agent 2 (zabbix_agent2, Go) run on monitored machines. They read local metrics (CPU, memory, disks, processes, logs). Agent 2 is newer, supports plugins, and can monitor more targets itself (databases, containers). It listens on port 10050 for passive checks and connects to the server on 10051 for active checks. See passive and active checks.

Proxy

zabbix_proxy collects data for a group of hosts, buffers it, and sends it to the server. It reduces load on the server and works across slow links or firewalls. Proxies are covered in the scaling chapter.

Helper tools

  • zabbix_get asks one agent for one item key from the command line, for example zabbix_get -s 192.0.2.10 -k system.uptime. It is the quickest way to test a key.
  • zabbix_sender pushes values to the server (to trapper items). It is used by scripts and cron jobs.
  • Web service (zabbix_web_service): optional component for scheduled PDF reports.
  • Java gateway: optional component for JMX monitoring.

Default ports

Port Protocol Who listens Used for
10050 TCP Agent Passive checks from server or proxy
10051 TCP Server, proxy Active checks, trappers, proxy data
80 / 443 TCP Web server Frontend
3306 / 5432 TCP Database MySQL / PostgreSQL
161 UDP SNMP device SNMP polling
162 UDP Server (optional) SNMP traps via a trap receiver

A frequent cause of "Zabbix agent is not available" is a firewall between server and agent blocking 10050.

Python Stand-in: which port does it use?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

How a value travels

  1. A poller (or the agent, for active checks) collects a raw value.
  2. The value goes through preprocessing (multipliers, JSONPath, change per second...).
  3. The history syncer writes it to the database and the server's in-memory value cache.
  4. The server evaluates every trigger that uses this item.
  5. If a trigger changes to PROBLEM, the server creates an event and runs matching actions.
  6. The frontend reads history from the database to draw graphs and dashboards.
Python Stand-in: a value's journey

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Server processes and caches

The server has tunable settings that map to its internal workers: StartPollers, StartTrappers, StartPreprocessors, StartDBSyncers, CacheSize (configuration cache), ValueCacheSize and HistoryCacheSize. Defaults suit small installations. The Zabbix server itself exposes internal items such as zabbix[queue], zabbix[wcache,values] and zabbix[process,poller,avg,busy], so you can monitor Zabbix with Zabbix. A template called "Zabbix server health" does this.

Deployment shapes

  • All-in-one: server, database, frontend and agent on one machine. Good for labs and up to a few hundred hosts.
  • Split: database on its own host, frontend on a second one, server on a third.
  • High availability: since Zabbix 6.0 the server supports native HA: several server nodes share a database, one is active and the others are standby.
  • Distributed: proxies at each site report to a central server.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which component writes collected values to the database?

    The server's history syncer processes persist values; the frontend only reads and edits configuration.
  2. 2. Which port does the agent listen on for passive checks?

    Agents listen on TCP 10050. Server and proxy listen on 10051.
  3. 3. What is zabbix_get used for?

    zabbix_get queries one key on one agent, handy for testing; zabbix_sender is the pushing tool.
  4. 4. Why use a proxy?

    Proxies collect for groups of hosts and forward data to the server.

Summary

  • Server (collects, evaluates, alerts), database (stores everything), frontend (configuration and display), agents and proxies (collect).
  • Ports: 10050 agent, 10051 server/proxy, 161 SNMP.
  • A value goes through collection, preprocessing, storage, trigger evaluation, then actions.
  • zabbix_get tests keys; zabbix_sender pushes data.
  • Zabbix can monitor itself with internal items.

Next: Installing the Zabbix server