11 图原型
描述
这些参数以及相应 dashboard widget 字段对象的可能属性值,可用于在 dashboard.create 和 dashboard.update 方法中配置 Graph prototype widget。
在创建或更新 dashboard 时,不会对 widget 的 fields 属性进行校验。
这使用户可以修改 内置 widget 并创建 自定义 widget,但也会带来错误创建或更新 widget 的风险。
为确保成功创建或更新 Graph prototype widget,请参阅下表中概述的参数行为。
参数
以下参数适用于 Graph prototype 小组件。
| Parameter | type | name | value | |
|---|---|---|---|---|
| Refresh interval | 0 | rf_rate | 0 - 不刷新; 10 - 10 秒; 30 - 30 秒; 60 - (默认) 1 分钟; 120 - 2 分钟; 600 - 10 分钟; 900 - 15 分钟。 |
|
| Source | 0 | source_type | 2 - (默认) Graph prototype; 3 - Simple graph prototype。 |
|
| Graph prototype | 7 | graphid.0 | Graph prototype ID。 Parameter behavior: - 如果 Source 设置为 "Graph prototype",则为 required |
|
| Item prototype | 5 | itemid.0 | Item prototype ID。 Parameter behavior: - 如果 Source 设置为 "Simple graph prototype",则为 required |
|
| Time period | 1 | time_period._reference | DASHBOARD._timeperiod - 将 Time period 选择器 设为数据源;ABCDE._timeperiod - 将一个 兼容的小组件(其 Reference 参数设为 "ABCDE")设为数据源。默认: DASHBOARD._timeperiod或者,您也可以仅在 From 和 To 参数中设置时间段。 |
|
| From | 1 | time_period.from | 有效的时间字符串,支持绝对时间语法(YYYY-MM-DD hh:mm:ss)或 相对 时间语法(now、now/d、now/w-1w 等)。Parameter behavior: - 如果未设置 Time period,则为 supported - 如果设置了 time_period.to,则为 required |
|
| To | 1 | time_period.to | 有效的时间字符串,支持绝对时间语法(YYYY-MM-DD hh:mm:ss)或 相对 时间语法(now、now/d、now/w-1w 等)。Parameter behavior: - 如果未设置 Time period,则为 supported - 如果设置了 time_period.from,则为 required |
|
| Show legend | 0 | show_legend | 0 - 禁用; 1 - (默认) 启用。 |
|
| Override host | 1 | override_hostid._reference | ABCDE._hostid - 将一个 兼容的小组件(其 Reference 参数设为 "ABCDE")设为主机的数据源;DASHBOARD._hostid - 将仪表板的 Host 选择器 设为主机的数据源。如果在 模板仪表板 上配置该小组件,则不支持此参数。 |
|
| Columns | 0 | columns | 取值范围为 1-24。 默认:2。 |
|
| Rows | 0 | rows | 取值范围为 1-16。 默认:1。 |
|
| Reference | 1 | reference | 任意由 5 个字符组成的字符串值(例如 ABCDE 或 JBPNL)。该值在小组件所属的仪表板内必须唯一。Parameter behavior: - required |
|
示例
以下示例仅用于描述针对图形原型(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
}