This wiki is outdated and will be removed on 2015.03.01. Do not rely on this information. Move any useful information to the Zabbix community wiki at www.zabbix.org
Translations of this page:
ODT Export
 

Zabbix API

This section contains community-related information about Zabbix API.

Covered versions

Zabbix API was introduced in Zabbix version 1.7.

Accessing the API

The API is implemented in JSON-RPC. That means, to call any function, you need to send a POST request to http://<zabbix_server>/zabbix/api_jsonrpc.php with input data in JSON (i.e. JavaScript structure textual representation) format in the request body and interpret the answer formatted the same way.

A request should look like this (plain text, the fancy formatting is optional of course):

{ "jsonrpc":"2.0",                             //json-rpc protocol version used
  "method":"apiinfo.version",                  //full API function name
  "params":[ <arg_1>, <arg_2> ],               //positional arguments, or
  "params":{"name1":<arg_1>,"name2":<arg_2>},  //named arguments
  "auth":"a6e895b98fde40f4f7badf112fd983bf",   //omit to work anonymously
  "id":2                                       //any value to identify the request; JSON-RPC 2.0 standard recommends an integer
}

A response looks like:

{ "jsonrpc":"2.0",
  "result":<value>,                            //can be of any representable type
  "id":2                                       //corresponds to the request
}

The auth hash to use is obtained with user.authenticate API:

{ "jsonrpc":"2.0",
"method":"user.authenticate",
"params":{
    "user":"<login>",
    "password":"<password>"
},
"id":2
}

Community provided tools

See a list of various Zabbix API libraries.

 
doc/api.txt · Last modified: 2013/02/06 18:30 by richlv
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki