Skip to content

The moving parts

Status: verified

Five pieces, and it pays to know which one holds what: the server thinks, the database remembers, the agent answers, the frontend shows, and the API lets programs do everything the frontend does. When something is wrong, the piece at fault is almost always findable by which of those verbs stopped working.

The server (zabbix_server) is the brain, and it is not one process but a small crowd of them, each with a job: pollers go out and ask questions, trappers sit listening for answers that arrive unasked, an escalator runs the actions, alerters send the messages, a housekeeper prunes old history. You will see this crowd in the process list and in the server's log, where each worker signs its lines. The server keeps almost nothing in files: its configuration is one text file (where the database lives, which ports to listen on), and everything it knows — hosts, items, history, problems, users — is in the database.

The database is PostgreSQL or MySQL; this guide uses PostgreSQL, as the project itself recommends for new installs. The server creates nothing here: you create an empty database and a user for it, then import a schema file the project ships — in the lab, 203 tables — and the server's first log lines include the version it found there. Everything afterwards is a row somewhere: an item's every answer, a problem and its recovery, an alert and the error it failed with. That is why chapter 3 spends its care on this piece, and why sizing it matters (the lab's first failure was a database with too few connections for the server's crowd — chapter 14 tells it).

The agent is the witness on each watched machine. This guide uses Zabbix agent 2, the current agent, written in Go, which answers questions over the network: built-in keys (system.cpu.load, agent.ping, hundreds more), commands you define yourself as user parameters — the lab's gauge is one line of agent configuration that turns a file's contents into an answer — and plugins for databases and other software. The agent listens on port 10050 by default. It can also speak first: active checks have the agent ask the server what to watch and send answers unprompted, which is how machines behind address translation still get monitored. The older C agent and the agent-2 in this guide answer the same keys; nothing else in the guide depends on which an old machine runs.

The frontend is a PHP web application — the pages you log into. It talks to the database for what you see and to the server for live commands, and it writes almost nothing itself: the same information is in the API's answers. In production it runs under Apache or nginx with PHP-FPM; in this guide's lab it ran under PHP's own built-in server on loopback — a stand-in that serves the same pages for one reader, and no way to run a real service (chapter 13 lists it as such).

The API is a JSON-RPC endpoint on the frontend (/api_jsonrpc.php). You log in with a user name and password (or present a token), receive a token, and then call methods — host.get, item.create, problem.get — whose parameters and answers mirror the web pages field for field. It is not a side door: it is how the frontend's own scripts and every serious Zabbix automation work, and it is why this guide can show its proofs in text. Alongside it, two small command-line tools complete the kit: zabbix_get, which asks one agent one question from the terminal (the fastest health check there is), and zabbix_sender, which pushes a value to the server for items that wait to be told.

Two more pieces exist and this guide names once, plainly as not-run: the proxy, a smaller server that watches a remote network on the main server's behalf and forwards what it learns, and SNMP, the protocol network hardware speaks, which the server polls directly. Both are normal production tools; the lab had neither a second network nor a device, so they are described from the documentation where they appear (chapters 12 and 13) and never pretended into evidence.

The check. Name the piece before you fix the problem: values stopped arriving but the pages load — pollers or the agent; pages will not load but values land in the database — the frontend; a problem exists but nobody was told — the escalator, the action, or the media; everything works in the browser and fails in a script — the API token. Chapter 14 turns that into a table; it works because the pieces are really this separate.