This section provides details on passive and active checks performed by Zabbix agent.
Zabbix uses a JSON based communication protocol for communicating with Zabbix agent.
There are some definitions used in the details of protocols used by Zabbix:
<HEADER> - "ZBXD\x01" (5 bytes) <DATALEN> - data length (8 bytes). 1 will be formatted as 01/00/00/00/00/00/00/00 (eight bytes in HEX, 64 bit number)
To not exhaust memory (potentially) Zabbix server is limited to accept only 128MB in one connection (unlimited before Zabbix 2.0.3) when using the Zabbix protocol.
A passive check is a simple data request. Zabbix server or proxy asks for some data (for example, CPU load) and Zabbix agent sends back the result to the server.
Server request
<item key>\n
Agent response
<HEADER><DATALEN><DATA>
For example:
Active checks require more complex processing. The agent must first retrieve from the server(s) a list of items for independent processing.
The agent then periodically sends the new values to the server(s).
Agent request
<HEADER><DATALEN>{ "request":"active checks", "host":"<hostname>" }
Server response
{ "response":"success", "data":[ { "key":"log[\/home\/zabbix\/logs\/zabbix_agentd.log]", "delay":"30", "lastlogsize":"0" }, { "key":"agent.version", "delay":"600" } ] }
The server must respond with success. For each returned item, key and delay must exist. For items having type “Log”, the lastlogsize must exist as well.
For example:
Agent sends
<HEADER><DATALEN>{ "request":"agent data", "data":[ { "host":"<hostname>", "key":"log[\/home\/zabbix\/logs\/zabbix_agentd.log]", "value":" 13039:20090907:184546.759 zabbix_agentd started. ZABBIX 1.6.6 (revision {7836}).", "lastlogsize":80, "clock":1252926015 }, { "host":"<hostname>", "key":"agent.version", "value":"1.6.6", "clock":1252926015 } ], "clock":1252926016 }
Server response
<HEADER><DATALEN>{ "response":"success", "info":"Processed 2 Failed 0 Total 2 Seconds spent 0.002070" }
For example: