Sidebar

Become a monitoring expert!
Sign up for Zabbix training

检索模板仪表盘

描述

integer/array templatedashboard.get(object parameters)

该方法允许根据给定的参数检索模板仪表盘。

该方法仅对超级管理员用户有效。可以在用户角色设置中撤销调用该方法的权限。 详情查阅 User roles

参数

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

该方法支持以下参数。

参数 类型 描述
dashboardids string/array 仅返回具有给定ID的模板仪表盘。
templateids string/arary 仅返回属于给定模板的模板仪表盘。
selectPages query 按正确顺序返回带有模板仪表盘页面的pages属性。
sortfield string/array 按给定属性对结果进行排序。

可能的值是: dashboardid and name.
countOutput boolean These parameters being common for all methods are described in detail in the .这些参数对于所有get方法都是通用的,在参考注释中有详细描述。
editable boolean
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

返回值

(integer/array) 返回两者其一:

  • 一个对象数组;
  • 如果使用了'countOutput'参数,则对检索对象进行计数。

示例

检索模版仪表盘

检索指定模板的所有带有组件的模板仪表板。

请求:

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

响应:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "dashboardid": "23",
                   "name": "Docker overview",
                   "templateid": "10001",
                   "display_period": "30",
                   "auto_start": "1",
                   "uuid": "6dfcbe0bc5ad400ea9c1c2dd7649282f",
                   "pages": [
                       {
                           "dashboard_pageid": "1",
                           "name": "",
                           "display_period": "0",
                           "widgets": [
                               {
                                   "widgetid": "220",
                                   "type": "graph",
                                   "name": "",
                                   "x": "0",
                                   "y": "0",
                                   "width": "12",
                                   "height": "5",
                                   "view_mode": "0",
                                   "fields": [
                                       {
                                           "type": "6",
                                           "name": "graphid",
                                           "value": "1125"
                                       }
                                   ]
                               },
                               {
                                   "widgetid": "221",
                                   "type": "graph",
                                   "name": "",
                                   "x": "12",
                                   "y": "0",
                                   "width": "12",
                                   "height": "5",
                                   "view_mode": "0",
                                   "fields": [
                                       {
                                           "type": "6",
                                           "name": "graphid",
                                           "value": "1129"
                                       }
                                   ]
                               },
                               {
                                   "widgetid": "222",
                                   "type": "graph",
                                   "name": "",
                                   "x": "0",
                                   "y": "5",
                                   "width": "12",
                                   "height": "5",
                                   "view_mode": "0",
                                   "fields": [
                                       {
                                           "type": "6",
                                           "name": "graphid",
                                           "value": "1128"
                                       }
                                   ]
                               },
                               {
                                   "widgetid": "223",
                                   "type": "graph",
                                   "name": "",
                                   "x": "12",
                                   "y": "5",
                                   "width": "12",
                                   "height": "5",
                                   "view_mode": "0",
                                   "fields": [
                                       {
                                           "type": "6",
                                           "name": "graphid",
                                           "value": "1126"
                                       }
                                   ]
                               },
                               {
                                   "widgetid": "224",
                                   "type": "graph",
                                   "name": "",
                                   "x": "0",
                                   "y": "10",
                                   "width": "12",
                                   "height": "5",
                                   "view_mode": "0",
                                   "fields": [
                                       {
                                           "type": "6",
                                           "name": "graphid",
                                           "value": "1127"
                                       }
                                   ]
                               }
                           ]
                       }
                   ]
               }
           ],
           "id": 1
       }

参阅

源码

CTemplateDashboard::get() in ui/include/classes/api/services/CTemplateDashboard.php.