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

Docs/protocols/zabbix proxy/2.0

From Zabbix.org
Jump to: navigation, search

Zabbix proxy protocol

Active proxy

Proxy configuration

Active proxy asks for configuration data:

{
        "request":"proxy config",
        "host":"Proxy 115"}

An example of Zabbix 2.0 server sending configuration data to the Zabbix proxy.

Note: Only the applications that are assigned to web scenarios are sent to the proxy.
{
        "globalmacro":{
                "fields":["globalmacroid","macro","value"],
                "data":[
                        [2,"{$SNMP_COMMUNITY}","public"]]},
        "hosts":{
                "fields":["hostid","host","status","ipmi_authtype","ipmi_privilege","ipmi_username","ipmi_password","name"],
                "data":[
                        [10086,"C_Template_Linux",3,0,2,"","","C_Template_Linux"],
                        [10087,"Server 101",0,-1,2,"","","Server 101"]]},
        "interface":{
                "fields":["interfaceid","hostid","main","type","useip","ip","dns","port"],
                "data":[
                        [3,10087,1,1,1,"192.168.5.101","","10050"]]},
        "hosts_templates":{
                "fields":["hosttemplateid","hostid","templateid"],
                "data":[
                        [41,10087,10086]]},
        "hostmacro":{
                "fields":["hostmacroid","hostid","macro","value"],
                "data":[
                        [1,10087,"{$HOST_MACRO}","1"],
                        [2,10086,"{$TEMPLATE_MACRO}","2"]]},
        "items":{
                "fields":["itemid","type","snmp_community","snmp_oid","hostid","key_","delay","status","value_type","trapper_hosts","snmpv3_securityname","snmpv3_securitylevel","snmpv3_authpassphrase","snmpv3_privpassphrase","formula","logtimefmt","delay_flex","params","ipmi_sensor","data_type","authtype","username","password","publickey","privatekey","flags","filter","interfaceid","port"],
                "data":[
                        [23334,0,"","",10087,"net.if.in[eth0]",30,0,3,"","",0,"","","1","","","","",0,0,"","","","",0,"",3,""],
                        [23335,0,"","",10087,"net.if.out[eth0]",30,0,3,"","",0,"","","1","","","","",0,0,"","","","",0,"",3,""],
                        [23336,0,"","",10087,"system.cpu.load",30,0,0,"","",0,"","","1","","","","",0,0,"","","","",0,"",3,""],
                        [23418,0,"","",10087,"agent.ping",30,0,3,"","",0,"","","1","","","","",0,0,"","","","",0,"",3,""],
                        [23447,9,"","",10087,"web.test.in[Web page monitoring,,bps]",60,0,0,"","",0,"","","1","","","","",0,0,"","","","",0,"",null,""],
                        [23448,9,"","",10087,"web.test.fail[Web page monitoring]",60,0,3,"","",0,"","","1","","","","",0,0,"","","","",0,"",null,""],
                        [23449,9,"","",10087,"web.test.error[Web page monitoring]",60,0,1,"","",0,"","","1","","","","",0,0,"","","","",0,"",null,""],
                        [23450,9,"","",10087,"web.test.in[Web page monitoring,First page,bps]",60,0,0,"","",0,"","","1","","","","",0,0,"","","","",0,"",null,""],
                        [23451,9,"","",10087,"web.test.time[Web page monitoring,First page,resp]",60,0,0,"","",0,"","","1","","","","",0,0,"","","","",0,"",null,""],
                        [23452,9,"","",10087,"web.test.rspcode[Web page monitoring,First page]",60,0,3,"","",0,"","","1","","","","",0,0,"","","","",0,"",null,""]]},
        "drules":{
                "fields":["druleid","iprange","delay"],
                "data":[
                        [2,"192.168.1.1-255",3600]]},
        "dchecks":{
                "fields":["dcheckid","druleid","type","key_","snmp_community","ports","snmpv3_securityname","snmpv3_securitylevel","snmpv3_authpassphrase","snmpv3_privpassphrase","uniq"],
                "data":[
                        [2,2,9,"system.uname","","10050","",0,"","",0]]},
        "regexps":{
                "fields":["regexpid","name"],
                "data":[
                        [1,"File systems for discovery"],
                        [2,"Network interfaces for discovery"],
                        [3,"Storage devices for SNMP discovery"]]},
        "expressions":{
                "fields":["expressionid","regexpid","expression","expression_type","exp_delimiter","case_sensitive"],
                "data":[
                        [1,1,"^(btrfs|ext2|ext3|ext4|jfs|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|ntfs|fat32)$",3,",",0],
                        [2,2,"^lo$",4,",",1],
                        [3,3,"^(Physical memory|Virtual memory|Memory buffers|Cached memory|Swap space)$",4,",",1],
                        [4,2,"^Software Loopback Interface",4,",",1]]},
        "groups":{
                "fields":["groupid"],
                "data":[
                        [5]]},
        "config":{
                "fields":["configid","refresh_unsupported","discovery_groupid","snmptrap_logging"],
                "data":[
                        [1,600,5,1]]},
        "applications":{
                "fields":["applicationid","hostid","name"],
                "data":[
                        [385,10087,"Web"]]},
        "httptest":{
                "fields":["httptestid","name","applicationid","delay","macros","agent","authentication","http_user","http_password"],
                "data":[
                        [2,"Web page monitoring",385,60,"","Lynx\/2.8.7rel.1 libwww-FM\/2.14 SSL-MM\/1.4.1 OpenSSL\/0.9.8r",0,"",""]]},
        "httptestitem":{
                "fields":["httptestitemid","httptestid","itemid","type"],
                "data":[
                        [4,2,23447,2],
                        [5,2,23448,3],
                        [6,2,23449,4]]},
        "httpstep":{
                "fields":["httpstepid","httptestid","name","no","url","timeout","posts","required","status_codes"],
                "data":[
                        [2,2,"First page",1,"http:\/\/web-page\/url",15,"","",""]]},
        "httpstepitem":{
                "fields":["httpstepitemid","httpstepid","itemid","type"],
                "data":[
                        [4,2,23450,2],
                        [5,2,23451,1],
                        [6,2,23452,0]]}}
Note: Groups and discovery group in the config table are not required by the proxy - they are only sent because that field can not be NULL in the database schema.

If proxy hostname does not match, server provides no response at all as of Zabbix 2.0.5 - see ZBX-6221

Sending host availability data

Proxy sends host availability data in a separate request. A single dataset will be sent right after proxy startup, containing information about all hosts and all availability types (agent, SNMP, JMX, IPMI). Similarly, if a new host has been added, full availability information about this host will be sent initially.

{
        "request":"host availability",
        "host":"Proxy 115",
        "data":[
                {
                        "hostid":10087,
                        "available":1,
                        "snmp_available":0,
                        "ipmi_available":0,
                        "jmx_available":0,
                        "error":"",
                        "snmp_error":"",
                        "ipmi_error":"",
                        "jmx_error":""}]}
Note: Zabbix proxy in 2.0 also sends availability data for templates. This is fixed for 2.1.0. See ZBX-6219

When host availability changes later, only the changed availability is sent:

{
        "request":"host availability",
        "host":"Proxy 115",
        "data":[
                {
                        "hostid":10087,
                        "available":2,
                        "error":"Get value from agent failed: cannot connect to [[192.168.5.101]:10050]: [111] Connection refused"}]}

If everything is well, server responds with:

{
        "response":"success"}

In case of major failure (for example, proxy hostname not matching) server responds with:

{
        "response":"failed"}

Sending historical data

{
        "request":"history data",
        "host":"Proxy 115",
        "data":[
                {
                        "host":"Server 101",
                        "key":"web.test.in[Web page monitoring,First page,bps]",
                        "clock":1360159028,
                        "ns":648067157,
                        "value":"0.000000"},
                {
                        "host":"Server 101",
                        "key":"web.test.time[Web page monitoring,First page,resp]",
                        "clock":1360159028,
                        "ns":648067157,
                        "value":"0.000000"},
                {
                        "host":"Server 101",
                        "key":"web.test.rspcode[Web page monitoring,First page]",
                        "clock":1360159028,
                        "ns":648067157,
                        "value":"0"},
                {
                        "host":"Server 101",
                        "key":"web.test.in[Web page monitoring,,bps]",
                        "clock":1360159028,
                        "ns":648067157,
                        "value":"0.000000"},
                {
                        "host":"Server 101",
                        "key":"web.test.fail[Web page monitoring]",
                        "clock":1360159028,
                        "ns":648067157,
                        "value":"1"},
                {
                        "host":"Server 101",
                        "key":"web.test.error[Web page monitoring]",
                        "clock":1360159028,
                        "ns":648067157,
                        "value":"cURL library is required for Web monitoring support"}],
        "clock":1360159033}

Server response:

{
        "response":"success",
        "info":"Processed 6 Failed 0 Total 6 Seconds spent 0.000462"}

In case of major failure (for example, proxy hostname not matching) server responds with:

{
        "response":"failed"}

Sending discovery data

{
        "request":"discovery data",
        "host":"Proxy 115",
        "data":[
                {
                        "clock":1360161129,
                        "drule":2,
                        "dcheck":2,
                        "type":9,
                        "ip":"192.168.18.8",
                        "dns":"",
                        "port":10050,
                        "key":"system.uname",
                        "status":1},
                {
                        "clock":1360161126,
                        "drule":2,
                        "dcheck":null,
                        "type":-1,
                        "ip":"192.168.18.8",
                        "dns":"",
                        "status":1}],
        "clock":1360161129}

dcheck is check ID for services and null for hosts. Status 0 is up and 1 is down.

If everything is well, server responds with:

{
        "response":"success"}

In case of failure (for example, proxy hostname not matching) server responds with:

{
        "response":"failed"}

Sending heartbeat data

{
        "request":"proxy heartbeat",
        "host":"Proxy 115"}

If everything is well, server responds with:

{
        "response":"success"}

If proxy hostname does not match, server provides no response at all as of Zabbix 2.0.5 - see ZBX-6221

Sending auto-registration data

{
        "request":"auto registration",
        "host":"Proxy 115",
        "data":[
                {
                        "clock":1360179544,
                        "host":"Server 115",
                        "ip":"192.168.5.115",
                        "port":"10050"}

If everything is well, server responds with:

{
        "response":"success"}

In case of failure (for example, proxy hostname not matching) server responds with:

{
        "response":"failed"}

Passive proxy

When server connects to the passive proxy to send configuration data, the contents are exactly as the ones sent to the active proxy, except they are wrapped in a "proxy config" request and data array:

{
        "request":"proxy config",
        "data":{
                "globalmacro":{
...
                }
        }
}

If server attempts to send configuration data in this manner to the active proxy, active proxy sends empty response, which server considers to be a failure.

For availability data, server sends to the proxy:

{
        "request":"host availability"}

If server attempts to ask for the availability data in this manner to the active proxy, active proxy sends empty response, which server considers to be a success and tries to respond with:

{
        "response":"success"}

But by that time proxy has already closed the connection.