图原型 11

描述

这些参数以及相应仪表板 widget 字段的可能属性值 objects 允许在 dashboard.createdashboard.update 方法中配置 Graph prototype widget。

在创建或 update 仪表板时,不会验证 widget fields 属性。
这允许用户修改 built-in widgets 和 create custom widgets,但也存在创建或更新小部件错误的风险。
为确保成功创建或 update 图形原型 小部件,请参考下表中列出的参数行为。

参数

以下参数支持用于图形原型(Graph prototype)小部件。

参数 仪表板小部件字段 名称
Refresh interval 0 rf_rate 0 - 无刷新;
10 - 10 秒;
30 - 30 秒;
60 - (默认) 1 分钟;
120 - 2 分钟;
600 - 10 分钟;
900 - 15 分钟。
Source 0 source_type 2 - (默认) 图形原型;
3 - 简单图形原型。
Graph prototype 7 graphid.0 Graph prototype ID.

参数行为:
- 必填 设置为 "图表原型"
Item prototype 5 itemid.0 Item prototype ID。

参数行为
- 必填 设置为 "简单图形原型"
Time period 1 time_period._reference DASHBOARD._timeperiod - 将Time period selector设置为数据源;
ABCDE._timeperiod - 将部件兼容性(将其Reference参数设置为"ABCDE")设置为数据源。

默认值: DASHBOARD._timeperiod

或者,您可以在FromTo参数中仅设置时间周期。
1 time_period.from 绝对时间(YYYY-MM-DD hh:mm:ss)或relative时间语法(nownow/dnow/w-1w 等)格式的有效时间 string。

参数行为:
- 时间周期 未设置时为 支持
1 time_period.to 绝对时间(YYYY-MM-DD hh:mm:ss)或relative时间格式(nownow/dnow/w-1w 等)的有效时间 string。

参数行为:
- 支持 如果未设置“时间段”
Show legend 0 show_legend 0 - 已禁用;
1 - (默认) 已启用。
Override host 1 override_hostid._reference ABCDE._hostid - 将一个 部件兼容性(将其 Reference 参数设置为 "ABCDE")设置为 主机 的数据源;
DASHBOARD._hostid - 将仪表板 覆盖主机 设置为 主机 的数据源。

如果在 template dashboard 上配置 widget,则不支持此参数。
Columns 0 columns 可能值的范围为 1-24。

默认值:2。
Rows 0 rows 可能的取值范围为 1-16。

默认值:1。
Reference 1 reference 任何由 5 个字符组成的 string 值(例如 ABCDEJBPNL)。此值在该 widget 所属的仪表板内必须唯一。

参数行为:
- 必填

示例

以下示例仅用于描述针对图形原型(Graph prototype)控件的仪表板 widget 字段 objects 的配置。
有关配置仪表板的更多信息,请参见 dashboard.create

配置 图形原型 部件

配置一个图形原型 widget,该原型显示一个由低级别自动发现创建的3图形网格(3列,1行),这些图形来源于一个监控项原型(ID:"42316")。

执行请求:

{
           "jsonrpc": "2.0",
           "method": "dashboard.create",
           "params": {
               "name": "My dashboard",
               "display_period": 30,
               "auto_start": 1,
               "pages": [
                   {
                       "widgets": [
                           {
                               "type": "graphprototype",
                               "name": "Graph prototype",
                               "x": 0,
                               "y": 0,
                               "width": 48,
                               "height": 5,
                               "view_mode": 0,
                               "fields": [
                                   {
                                       "type": 0,
                                       "name": "source_type",
                                       "value": 3
                                   },
                                   {
                                       "type": 5,
                                       "name": "itemid.0",
                                       "value": 42316
                                   },
                                   {
                                       "type": 0,
                                       "name": "columns",
                                       "value": 3
                                   },
                                   {
                                       "type": 1,
                                       "name": "reference",
                                       "value": "OPQWX"
                                   }
                               ]
                           }
                       ]
                   }
               ],
               "userGroups": [
                   {
                       "usrgrpid": 7,
                       "permission": 2
                   }
               ],
               "users": [
                   {
                       "userid": 1,
                       "permission": 3
                   }
               ]
           },
           "id": 1
       }

响应:

{
           "jsonrpc": "2.0",
           "result": {
               "dashboardids": [
                   "3"
               ]
           },
           "id": 1
       }

另请参阅