See www.zabbix.com for the official Zabbix site.

Docs/protocols/zabbix sender/1.1

From Zabbix.org
Jump to: navigation, search

Zabbix sender 1.1 protocol

The Zabbix sender protocol uses XML fragments to send information to the Zabbix server. The agent must establish a new TCP connection to port 10051 (default) on the server. Then the agent must send an XML fragment like this:

<req>
  <host>hostname</host>
  <key>item key</key>
  <data>item value</data>
</req>
  • Hostname is the hostname of the machine this item is configured for. Example: "Sonic server"
  • Item key is the key of the configured item, which must be of type "Zabbix trapper". Example: Domain1.DomainManager.AGENT.system.memory.CurrentUsage
  • Item value is the value of the item. Example: 72649274 (the unit is configured in Zabbix)

All these strings must be base64 encoded when sending. Since Zabbix does not use an XML parser, it cannot properly parse anything other than the exact request string above with base64'ed data values (whitespace is allowed).

An example request looks like this:

<req>
  <host>U29uaWM=</host>
  <key>RG9tYWluMS5Eb21haW5NYW5hZ2VyLkFHRU5ULnN5c3RlbS5tZW1vcnkuQ3VycmVudFVzYWdl</key>
  <data>NzI2NDkyNzQ=</data>
</req>

After receipt of the request, the Zabbix server will respond with the literal string "OK" or "NOT OK". "OK" means that the item was processed correctly. "NOT OK" means that either the item was missing, the data was in incorrect format (supplied a float value when integer was expected for example) or some other error. There is no additional information when this happens so you'll just have to deal with it.

If you keep receiving "ZBX_NOTSUPPORTED" instead of "OK" or "NOT OK", check that you are using the port number of the Zabbix server. Perhaps you have accidentally entered the port number of a Zabbix agent, and they do not support trapping.

Note that you MUST disconnect the TCP connection after receiving the response. Sending multiple requests over a single connection is not supported and you risk tying up resources on the Zabbix server if you keep the connection open for too long.

Implementations

Ruby

Ruby example

Perl

Perl example