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

Docs/protocols/zabbix sender/2.0

From Zabbix.org
Jump to: navigation, search

Zabbix sender 2.0 protocol

Zabbix uses a JSON message after the Zabbix header.

Note: As of Zabbix 2.0.8 and 2.1.7, header is optional. If the header is included, message length is ignored, as long as it is not 0.

Sending the values:

{
        "request":"sender data",
        "data":[
                {
                        "host":"Host name 1",
                        "key":"item_key",
                        "value":"33"},
                {
                        "host":"Host name 2",
                        "key":"item_key",
                        "value":"55"
                }
        ]
}

Response (some values may fail to be accepted; they are not identified in the response).

Note: A feature request to identify failed items: ZBXNEXT-246
Note: A feature request to make the output more readable: ZBXNEXT-935
{                                                                                                                                                                                
        "response":"success",     
        "info":"Processed 1 Failed 1 Total 2 Seconds spent 0.000253"
}

If values are sent from a file with timestamps, timestamps are included for each value and also for the whole request:

{
        "request": "sender data",
        "data": [
                {
                        "host": "Host name 1",
                        "key": "item_key",
                        "value": "33",
                        "clock": 1381482894
                },
                {
                        "host": "Host name 2",
                        "key": "item_key",
                        "value": "55",
                        "clock": 1381482894
                }
        ],
        "clock": 1381482905
}

The timestamp for the whole request is used to adjust item timestamps to Zabbix server time.

Implementations

C#

See http://www.zabbix.com/forum/showthread.php?t=20047 (in Russian)

Java

Java example

Perl

http://search.cpan.org/~tex/Zabbix-Sender-0.03/lib/Zabbix/Sender.pm

Python

https://github.com/jbfavre/python-zabbix