2022 Zabbix中国峰会
2022 Zabbix中国峰会

Appendix 1. Reference commentary

附录 1.参考说明

Notation

注释

Data types

数据类型

The Zabbix API supports the following data types:

Zabbix API支持以下数据类型:

Type Description
boolean A boolean value, accepts either true or false.
flag The value is considered to be true if it is passed and not equal to null and false otherwise.
integer A whole number.
float A floating point number.
string A text string.
text A longer text string.
timestamp A Unix timestamp.
array An ordered sequence of values, that is, a plain array.
object An associative array.
query A 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 如果传递的值不等于nullfalse,则认为该值为true
integer 整数。
float 浮点数。
string 文本字符串。
text 长文本字符串。
timestamp Unix时间戳。
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 方法都支持以下参数:

Parameter Type Description
countOutput boolean Return the number of records in the result instead of the actual data.
editable boolean If set to true return only objects that the user has write permissions to.

Default: false.
excludeSearch boolean Return results that do not match the criteria given in the search parameter.
filter object Return 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.
limit integer Limit the number of records returned.
output query Object properties to be returned.

Default: extend.
preservekeys boolean Use IDs as keys in the resulting array.
search object Return 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.
searchByAny boolean If 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.
searchWildcardsEnabled boolean If set to true enables the use of "*" as a wildcard character in the search parameter.

Default: false.
sortfield string/array Sort 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.
sortorder string/array Order 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.
startSearch boolean The search parameter will compare the beginning of fields, that is, perform a LIKE "…%" search instead.

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

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

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

不适用于 text 字段。
limit integer 限制返回记录的数量。
output query 要返回的对象属性。

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

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

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

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

默认值: false
sortfield string/array Sort 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.
sortorder string/array Order 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.
startSearch boolean The search parameter will compare the beginning of fields, that is, perform a LIKE "…%" search instead.

Ignored if searchWildcardsEnabled is set to true.