4 Длина заголовка и данных


The header is present in all request and response messages between Zabbix components. It is required to determine the message length, if it is compressed or not, if it is a large packet or not.

Zabbix communications protocol has 1GB packet size limit per connection. The limit of 1GB is applied to both the received packet data length and the uncompressed data length.

When sending configuration to Zabbix proxy, the packet size limit is increased to 4GB to allow syncing large configurations. When data length before compression exceeds 4GB, Zabbix server automatically starts using the large packet format (0x04 flag) which increases the packet size limit to 16GB.

Note that while a large packet format can be used for sending any data, currently only the Zabbix proxy configuration syncer can handle packets that are larger than 1GB.


The header consists of four fields. All numbers in the header are formatted as little-endian.

Field Size Size
(large packet)
<PROTOCOL> 4 4 "ZBXD" or 5A 42 58 44
<FLAGS> 1 1 Protocol flags:
0x01 - Zabbix communications protocol
0x02 - compression
0x04 - large packet
<DATALEN> 4 8 Data length.
<RESERVED> 4 8 When compression is used (0x02 flag) - the length of uncompressed data
When compression is not used - 00 00 00 00


Здесь представлены выдержки кода, которые показывают как добавить заголовок Zabbix протокола к data, которые вы хотите отправить, чтобы получить packet вам необходимо отправлять на Zabbix, так чтобы он интерпретировался корректным образом.

Язык Код
bash printf -v LENGTH '%016x' "${#DATA}"PACK=""for (( i=14; i>=0; i-=2 )); do PACK="$PACK\\x${LENGTH:$i:2}"; doneprintf "ZBXD\1$PACK%s" "$DATA"
Java byte[] header = new byte[] {'Z', 'B', 'X', 'D', '\1',(byte)(data.length & 0xFF),(byte)((data.length >> 8) & 0xFF),(byte)((data.length >> 16) & 0xFF),(byte)((data.length >> 24) & 0xFF),'\0', '\0', '\0', '\0'};| |<|byte[] packet = new byte[header.length + data.length];System.arraycopy(header, 0, packet, 0, header.length);System.arraycopy(data, 0, packet, header.length, data.length);
PHP $packet = "ZBXD\1" . pack('P', strlen($data)) . $data;или$packet = "ZBXD\1" . pack('V', strlen($data)) . "\0\0\0\0" . $data;
Perl my $packet = "ZBXD\1" . pack('<Q', length($data)) . $data;илиmy $packet = "ZBXD\1" . pack('V', length($data)) . "\0\0\0\0" . $data;
Python packet = "ZBXD\1" + struct.pack('<Q', len(data)) + data