这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.

Sidebar

Zabbix Summit 2022
Register for Zabbix Summit 2022

获取

说明

integer/array templatescreen.get(object parameters)

此方法允许根据指定的参数来检索聚合图形模板。

参数

(object)定义所需输出的参数。

该方法支持以下参数。

参数 类 说明
hostids string/array 仅返回指定主机所属的聚合图形模板。
screenids string/array 仅返回指定ID的聚合图形模板。
screenitemids string/array 仅返回包含指定聚合图形项的聚合图形模板。
templateids string/arary 仅返回指定模板所属的聚合图形模板。
noInheritance flag 不返回继承的聚合图形模板。
selectScreenItems query 返回screenitems属性中聚合图形模板使用的聚合图形项。
sortfield string/array 按指定的属性对结果分类。
许可值为:screenidname
countOutput boolean 这些参数非常普遍,适用于所有的get方法,详情可在reference commentary中参考。
editable boolean
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

返回值

返回两者其中任一:

  • 一组对象;
  • 如果已经使用了countOutput参数,则检索对象的计数。

范例

从模板中检索聚合图形

从模板"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
       }

参考

源码

CTemplateScreen::get()方法可在ui/include/classes/api/services/CTemplateScreen.php中参考。