Zabbix Documentation 4.0

2.23.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.43.23.4

User Tools

Site Tools


manual:appendix:items:activepassive

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:appendix:items:activepassive [2016/03/29 09:11]
martins-v encryption is possible since 3.0
manual:appendix:items:activepassive [2018/12/07 11:36] (current)
martins-v better formatting
Line 3: Line 3:
 === Overview === === Overview ===
  
-This section provides details on passive and active checks performed by Zabbix agent.+This section provides details on passive and active checks performed by [[manual:​config:​items:​itemtypes:​zabbix_agent|Zabbix agent]].
  
 Zabbix uses a JSON based communication protocol for communicating with Zabbix agent. Zabbix uses a JSON based communication protocol for communicating with Zabbix agent.
- 
-There are some definitions used in the details of protocols used by Zabbix: 
- 
-<​code>​ 
-<​HEADER>​ - "​ZBXD\x01"​ (5 bytes) 
-<​DATALEN>​ - data length (8 bytes). 1 will be formatted as 01/​00/​00/​00/​00/​00/​00/​00 (eight bytes in HEX, 64 bit number) 
-</​code>​ 
- 
-To not exhaust memory (potentially) Zabbix server is limited to accept only 128MB in one connection when using the Zabbix protocol. 
  
 === Passive checks === === Passive checks ===
Line 22: Line 13:
 **Server request** **Server request**
  
-<​code><​item key>\n</​code>​+For definition of header and data length please refer to [[manual:​appendix:​protocols:​header_datalen|protocol details]]. 
 + 
 +<​code><​item key></​code>​
  
 **Agent response** **Agent response**
  
-<code><​HEADER><​DATALEN><​DATA>​[\0<​ERROR>​]</​code>​+<​code><​DATA>​[\0<​ERROR>​]</​code>​
  
 Above, the part in square brackets is optional and is only sent for not supported items. Above, the part in square brackets is optional and is only sent for not supported items.
Line 33: Line 26:
  
   - Server opens a TCP connection   - Server opens a TCP connection
-  - Server sends **agent.ping\n**+  - Server sends **<​HEADER><​DATALEN>​agent.ping**
   - Agent reads the request and responds with **<​HEADER><​DATALEN>​1**   - Agent reads the request and responds with **<​HEADER><​DATALEN>​1**
   - Server processes data to get the value, '​1'​ in our case   - Server processes data to get the value, '​1'​ in our case
Line 41: Line 34:
  
   - Server opens a TCP connection   - Server opens a TCP connection
-  - Server sends **vfs.fs.size[/​nono]\n**+  - Server sends **<​HEADER><​DATALEN>​vfs.fs.size[/​nono]**
   - Agent reads the request and responds with **<​HEADER><​DATALEN>​ZBX_NOTSUPPORTED\0Cannot obtain filesystem information:​ [2] No such file or directory**   - Agent reads the request and responds with **<​HEADER><​DATALEN>​ZBX_NOTSUPPORTED\0Cannot obtain filesystem information:​ [2] No such file or directory**
   - Server processes data, changes item state to not supported with the specified error message   - Server processes data, changes item state to not supported with the specified error message
Line 58: Line 51:
 **Agent request** **Agent request**
  
-<​code>​ +<​code ​javascript
-<​HEADER><​DATALEN>​{+{
     "​request":"​active checks",​     "​request":"​active checks",​
     "​host":"<​hostname>"​     "​host":"<​hostname>"​
Line 67: Line 60:
 **Server response** **Server response**
  
-<​code>​ +<​code ​javascript
-<​HEADER><​DATALEN>​{+{
     "​response":"​success",​     "​response":"​success",​
     "​data":​[     "​data":​[
Line 110: Line 103:
 **Agent sends** **Agent sends**
  
-<​code>​ +<​code ​javascript
-<​HEADER><​DATALEN>​{+{
     "​request":"​agent data",     "​request":"​agent data",
 +    "​session":​ "​12345678901234567890123456789012",​
     "​data":​[     "​data":​[
         {         {
Line 118: Line 112:
             "​key":"​agent.version",​             "​key":"​agent.version",​
             "​value":"​2.4.0",​             "​value":"​2.4.0",​
 +            "​id":​ 1,
             "​clock":​1400675595, ​           ​             "​clock":​1400675595, ​           ​
             "​ns":​76808644             "​ns":​76808644
Line 126: Line 121:
             "​lastlogsize":​112,​             "​lastlogsize":​112,​
             "​value":"​ 19845:​20140621:​141708.521 Starting Zabbix Agent [<​hostname>​]. Zabbix 2.4.0 (revision 50000).",​             "​value":"​ 19845:​20140621:​141708.521 Starting Zabbix Agent [<​hostname>​]. Zabbix 2.4.0 (revision 50000).",​
 +            "​id":​ 2,
             "​clock":​1400675595, ​           ​             "​clock":​1400675595, ​           ​
             "​ns":​77053975             "​ns":​77053975
Line 134: Line 130:
             "​state":​1,​             "​state":​1,​
             "​value":"​Cannot obtain filesystem information:​ [2] No such file or directory",​             "​value":"​Cannot obtain filesystem information:​ [2] No such file or directory",​
 +            "​id":​ 3,
             "​clock":​1400675595, ​           ​             "​clock":​1400675595, ​           ​
             "​ns":​78154128             "​ns":​78154128
Line 142: Line 139:
 } }
 </​code>​ </​code>​
 +
 +A virtual ID is assigned to each value. Value ID is a simple ascending counter, unique within one data session (identified by the session token). This ID is used to discard duplicate values that might be sent in poor connectivity environments.
  
 **Server response** **Server response**
  
-<​code>​ +<​code ​javascript
-<​HEADER><​DATALEN>​{+{
     "​response":"​success",​     "​response":"​success",​
     "​info":"​processed:​ 3; failed: 0; total: 3; seconds spent: 0.003534"​     "​info":"​processed:​ 3; failed: 0; total: 3; seconds spent: 0.003534"​
Line 169: Line 168:
 <​note>​Zabbix will take up to 16 MB of XML Base64-encoded data, but a single decoded value should be no longer than 64 KB otherwise it will be truncated to 64 KB while decoding.</​note>​ <​note>​Zabbix will take up to 16 MB of XML Base64-encoded data, but a single decoded value should be no longer than 64 KB otherwise it will be truncated to 64 KB while decoding.</​note>​
  
-=== See also === 
  
-  - [[https://​www.zabbix.org/​wiki/​Docs/​protocols/​zabbix_agent/​3.0|More details on Zabbix agent protocol]]