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

Docs/protocols/zabbix agent/1.6

From Zabbix.org
Jump to: navigation, search

Zabbix agent protocol

Active agents

When an active agent starts, it connects to the server to ask for any item it should be monitoring:

{
        "request":"active checks",
        "host":"Host name"
}
Items to be monitored exist

If the host is monitored and there are active items on it, agent will receive list of those items:

{
        "response":"success",
        "data":[
                {
                        "key":"mysql.queries[delete]",
                        "delay":30,
                        "lastlogsize":0},
                {
                        "key":"mysql.queries[insert]",
                        "delay":30,
                        "lastlogsize":0},
                {
                        "key":"mysql.queries[select]",
                        "delay":30,
                        "lastlogsize":0},
                {
                        "key":"log[\/var\/log\/localmessages,error]",
                        "delay":1,
                        "lastlogsize":12169}],
}

Things to pay attention to:

  • Although lastlogsize is only needed for log items, it has to be sent for all items as older agent versions expect that.

Agent will disconnect and collect some data. Once data is collected, it will connect to the server again and send it. Multiple values may be sent in one connection.

{
        "request":"agent data",
        "data":[
                {
                        "host":"Host name",
                        "key":"mysql.queries[insert]",
                        "value":"492508",
                        "clock":1360150944},
                {
                        "host":"Host name",
                        "key":"mysql.queries[select]",
                        "value":"2611786",
                        "clock":1360150944},
                {
                        "host":"Server 115",
                        "key":"log[\/var\/log\/localmessages]",
                        "value":"Jan 30 18:26:44 linux-h5fr dhcpcd[3782]: eth0: adding default route via 192.168.5.1 metric 0",
                        "lastlogsize":4315,
                        "clock":1360314499}

        ],
        "clock":1360150949
}

Things to pay attention to:

  • For log item, additionally lastlogsize is sent.

Server will respond with a summary:

{
        "response":"success",
        "info":"Processed 3 Failed 0 Total 3 Seconds spent 0.000110"
}

It is also possible that some of the values could not be accepted for some reason. 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 2 Failed 1 Total 3 Seconds spent 0.000113"
}
No active items

If host exists and is monitored, but has no active items, agent will receive empty data set:

{
        "response":"success",
        "data":[]
}
Host does not exist
{
        "response":"failed",
        "info":"host [Host name] not found"
}
Host not monitored

Host exists, but is disabled:

{
        "response":"failed",
        "info":"host [Host name] not monitored"
}