Zabbix Documentation 1.8

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


Sidebar

protocols:agent

1 Zabbix Agent

Zabbix uses JSON based communication protocol for communication with Zabbix Agent.

2 Passive checks

Passive check is a simple data request. Zabbix Server (or Proxy) asks for a data, for example, CPU load, and Zabbix Agent sends the result back to the Server.

Server Request

<item key>\n

Agent Response

<HEADER><DATALEN><DATA>

For example:

  1. Server opens TCP connection
  2. Server sends agent.ping\n
  3. Agent reads the request and responds with <HEADER><DATALEN>1
  4. Server processes data to get the value, '1' in our case
  5. TCP connection is closed

3 Active checks

Active checks requires more complex processing. The Agent must retrieve list of items for independent processing first. It also periodically sends new values to the Server.

3.1 Get list of items

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:

  1. Agent opens TCP connection
  2. Agent asks for the list of checks
  3. Server responds with a list of items (item key, delay)
  4. Agent parses the response
  5. TCP connection is closed
  6. Agent starts periodical collection of data

3.2 Send collected data

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:

  1. Agent opens TCP connection
  2. Agent sends list of values
  3. Server processes the data and sends status back
  4. TCP connection is closed