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

templatescreen.get

Description说明

integer/array templatescreen.get(object parameters)

The method allows to retrieve template screens according to the given parameters该方法允许根据指定的参数来检索模板聚合图形.

Parameters参数

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

The method supports the following parameters该方法支持以下参数.

Parameter参数 T pe类型 Des ription说明
hostids string/array Return only template screens that belong to the given hosts只返回所属指定主机的模板聚合图形.
screenids string/array Return only template screens with the given IDs只返回具有指定ID的模板聚合图形.
screenitemids string/array Return only template screens that contain the given screen items只返回包含指定聚合图形项的模板聚合图形.
templateids string/arary Return only template screens that belong to the given templates只返回所属指定模板的模板聚合图形.
noInheritance flag Do not return inherited template screens不返回继承的模板聚合图形.
selectScreenItems query Return the screen items that are used in the template screen in the screenitems property返回screenitems属性中模板聚合图形中使用的聚合图形项.
sortfield string/array Sort the result by the given properties按指定的属性对结果分类.

Possible values are可能的值为: screenid and和 name.
countOutput flag These parameters being common for all get methods are described in detail in the reference commentary. 在reference commentary中详细描述了所有get方法的这些参数。
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 screens from template从模板检索聚合图形

Retrieve all screens from template "10001" and all of the screen items从模板"10001"和所有聚合图形项中检索所有聚合图形.

Request请求:

{
           "jsonrpc": "2.0",
           "method": "templatescreen.get",
           "params":  {
               "output": "extend",
               "selectScreenItems": "extend",
               "templateids": "10001"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response响应:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "screenid": "3",
                   "name": "System performance",
                   "hsize": "2",
                   "vsize": "2",
                   "templateid": "10001",
                   "screenitems": [
                       {
                           "screenitemid": "20",
                           "screenid": "3",
                           "resourcetype": "0",
                           "resourceid": "433",
                           "width": "500",
                           "height": "120",
                           "x": "0",
                           "y": "0",
                           "colspan": "1",
                           "rowspan": "1",
                           "elements": "0",
                           "valign": "1",
                           "halign": "0",
                           "style": "0",
                           "url": ""
                       },
                       {
                           "screenitemid": "21",
                           "screenid": "3",
                           "resourcetype": "0",
                           "resourceid": "387",
                           "width": "500",
                           "height": "100",
                           "x": "0",
                           "y": "1",
                           "colspan": "1",
                           "rowspan": "1",
                           "elements": "0",
                           "valign": "1",
                           "halign": "0",
                           "style": "0",
                           "url": ""
                       },
                       {
                           "screenitemid": "22",
                           "screenid": "3",
                           "resourcetype": "1",
                           "resourceid": "10013",
                           "width": "500",
                           "height": "148",
                           "x": "1",
                           "y": "0",
                           "colspan": "1",
                           "rowspan": "1",
                           "elements": "0",
                           "valign": "1",
                           "halign": "0",
                           "style": "0",
                           "url": ""
                       },
                       {
                           "screenitemid": "23",
                           "screenid": "3",
                           "resourcetype": "1",
                           "resourceid": "22181",
                           "width": "500",
                           "height": "184",
                           "x": "1",
                           "y": "1",
                           "colspan": "1",
                           "rowspan": "1",
                           "elements": "0",
                           "valign": "1",
                           "halign": "0",
                           "style": "0",
                           "url": ""
                       }
                   ]
               }
           ],
           "id": 1
       }

See also参考

Source来源

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