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

templatescreenitem.get

Description说明

integer/array templatescreenitem.get(object parameters)

The method allows to retrieve template screen items according to the given parameters该方法用于根据规定的参数获取模板聚合图形项.

Parameters参数

(object) Parameters defining the desired output定义所需输出的参数.

The method supports the following parameters该方法提供以下参数.

Parameter参数 T pe类型 Des ription说明
screenids string/array Return only template screen items that belong to the given template screens只返回指定模板聚合图形所属ID的模板聚合图形项.
screenitemids string/array Return only template screen items with the given IDs只返回指定ID的模板聚合监控项.
hostids string/array Returns an additional real_resourceid property for each template screen item, that belongs to a screen from the given hosts or templates. The real_resourceid property contains the ID of object displayed on the screen.为每个模板聚合图形项返回一个额外的“real_resourceid”属性,该属性属于指定主机或模板的聚合图形。 real_resourceid属性包含屏幕上显示的对象ID
sortfield string/array Sort the result by the given properties按照给定的属性对结果进行排序.

Possible values are可能的值是: screenitemid and和 screenid.
countOutput flag These parameters being common for all get methods are described in detail in the reference commentary.这些参数对于所有的get方法是常见的,在reference commentsary中有详细描述。
editable boolean
excludeSearch flag
filter object
limit integer
output query
preservekeys flag
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch flag

Return values返回值

(integer/array) Returns either返回两者其中任一:

  • an array of objects一组对象;
  • the count of retrieved objects, if the countOutput parameter has been used.如果已经使用了“countOutput”参数,则检索对象的计数.

Examples范例

Retrieve template screen items for screen从聚合图形上检索模板聚合图形项

Return all template screen items from template screen "15".从模板聚合图形"15"返回所有模板聚合图形项.

Request请求:

{
           "jsonrpc": "2.0",
           "method": "templatescreenitem.get",
           "params": {
               "output": "extend",
               "screenids": "15"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response响应:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "screenitemid": "42",
                   "screenid": "15",
                   "resourcetype": "0",
                   "resourceid": "454",
                   "width": "500",
                   "height": "200",
                   "x": "0",
                   "y": "0",
                   "colspan": "1",
                   "rowspan": "1",
                   "elements": "0",
                   "valign": "1",
                   "halign": "0",
                   "style": "0",
                   "url": "",
                   "max_columns": "3"
               },
               {
                   "screenitemid": "43",
                   "screenid": "15",
                   "resourcetype": "0",
                   "resourceid": "455",
                   "width": "500",
                   "height": "270",
                   "x": "1",
                   "y": "0",
                   "colspan": "1",
                   "rowspan": "1",
                   "elements": "0",
                   "valign": "1",
                   "halign": "0",
                   "style": "0",
                   "url": "",
                   "max_columns": "3"
               }
           ],
           "id": 1
       }

Source来源

CTemplateScreenItem::get() in frontends/php/include/classes/api/services/CTemplateScreenItem.php.