Appendix 1. Reference commentary

附录 1.参考说明

Notation

注释

Data types

数据类型

The Zabbix API supports the following data types:

Zabbix API支持以下数据类型:

TypeDescription
booleanA boolean value, accepts either true or false.
flagThe value is considered to be ​true​ if it is passed and not equal to ​null​ and ​false​ otherwise.
integerA whole number.
floatA floating point number.
stringA text string.
textA longer text string.
timestampA Unix timestamp.
arrayAn ordered sequence of values, that is, a plain array.
objectAn associative array.
queryA value which defines, what data should be returned.

Can be defined as an array of property names to return only specific properties, or as one of the predefined values:
extend - returns all object properties;
count - returns the number of retrieved records, supported only by certain subselects.
数据类型描述
boolean布尔值, 只接受truefalse这两种参数。
flag如果传递的值不等于​null​ 和 ​false,则认为该值为​true
integer整数。
float浮点数。
string文本字符串。
text长文本字符串。
timestampUnix时间戳。
array有序的值序列, 即普通数组。
object关联数组。
query用于定义应该返回哪些数据。

可定义为仅返回特定属性的属性名称数组,或者定义为以下预定值之一:
extend - 返回所有对象属性;
count - 返回检索到的记录的数量,仅支持某些子查询。

Property labels

属性标签

Some of the objects properties are marked with short labels to describe their behavior. The following labels are used:

一些对象属性用短标签来描述它们的行为。使用了以下标签:

  • readonly - the value of the property is set automatically and cannot be defined or changed by the client;

  • constant - the value of the property can be set when creating an object, but cannot be changed after.

  • readonly - 属性的值是自动设置的,客户端不能定义或修改;

  • constant - 属性的值可以在创建对象时设置,创建之后则不能修改。

Reserved ID value “0”

预留ID值 “0”

Reserved ID value “0” can be used to filter elements and to remove referenced objects. For example, to remove a referenced proxy from a host, proxy_hostid should be set to 0 (“proxy_hostid”: “0”) or to filter hosts monitored by server option proxyids should be set to 0 (“proxyids”: “0”).

预留ID值 “0” 可以用来过滤元素和删除引用的对象。例如,要从主机上删除一个引用的代理,proxy_hostid应该设置为0(”proxy_hostid”: “0”);或者,要过滤被zabbix server监控的主机,proxyids选项则应该设置为0 (“proxyids”: “0”)。

Common “get” method parameters

常用的 “get” 方法参数

The following parameters are supported by all get methods:

所有get 方法都支持以下参数:

ParameterTypeDescription
countOutputbooleanReturn the number of records in the result instead of the actual data.
editablebooleanIf set to true return only objects that the user has write permissions to.

Default: false.
excludeSearchbooleanReturn results that do not match the criteria given in the search parameter.
filterobjectReturn only those results that exactly match the given filter.

Accepts an array, where the keys are property names, and the values are either a single value or an array of values to match against.

Doesn’t work for text fields.
limitintegerLimit the number of records returned.
outputqueryObject properties to be returned.

Default: extend.
preservekeysbooleanUse IDs as keys in the resulting array.
searchobjectReturn results that match the given wildcard search (case-insensitive).

Accepts an array, where the keys are property names, and the values are strings to search for. If no additional options are given, this will perform a LIKE “%…%” search.

Works only for string and text fields.
searchByAnybooleanIf set to true return results that match any of the criteria given in the filter or search parameter instead of all of them.

Default: false.
searchWildcardsEnabledbooleanIf set to true enables the use of “*” as a wildcard character in the search parameter.

Default: false.
sortfieldstring/arraySort the result by the given properties. Refer to a specific API get method description for a list of properties that can be used for sorting. Macros are not expanded before sorting.
sortorderstring/arrayOrder of sorting. If an array is passed, each value will be matched to the corresponding property given in the sortfield parameter.

Possible values are:
ASC - ascending;
DESC - descending.
startSearchbooleanThe search parameter will compare the beginning of fields, that is, perform a LIKE “…%” search instead.

Ignored if searchWildcardsEnabled is set to true.
参数数据类型描述
countOutputboolean返回结果中的记录数量,而不是实际数据。
editableboolean如果设置为“true”,则只返回用户具有写入权限的对象。

默认值: false
excludeSearchboolean返回与在 search 参数中给定的条件不匹配的结果。
filterobject仅返回与给定过滤器完全匹配的结果。

接受一个数组,键是属性名;要么是单个值,要么是要匹配的一组值。

不适用于 text 字段。
limitinteger限制返回记录的数量。
outputquery要返回的对象属性。

默认值: extend
preservekeysboolean在结果数组中,使用ID作为键。
searchobject返回与给定通配符搜索匹配的结果 (不区分大小写)。

接受一个数组,键是属性名,其值是要搜索的字符串。 如果没有提供额外的选项,将执行LIKE “%…%” 搜索。

仅适用于 stringtext 字段。
searchByAnyboolean如果设置为 true ,则返回与 filtersearch 参数中给出的任何条件匹配的结果,而不是匹配所有条件。

默认值: false
searchWildcardsEnabledboolean如果设置为 true ,则可以在 search 参数中使用 “*” 作为通配符。

默认值: false
sortfieldstring/arraySort the result by the given properties. Refer to a specific API get method description for a list of properties that can be used for sorting. Macros are not expanded before sorting.
sortorderstring/arrayOrder of sorting. If an array is passed, each value will be matched to the corresponding property given in the sortfield parameter.

Possible values are:
ASC - ascending;
DESC - descending.
startSearchbooleanThe search parameter will compare the beginning of fields, that is, perform a LIKE “…%” search instead.

Ignored if searchWildcardsEnabled is set to true.