这些参数及对应仪表板小部件字段objects的可选属性值允许通过dashboard.create
和dashboard.update
方法配置Graph prototype小部件。
小部件fields
的属性在仪表板创建或update过程中不会进行验证。 这使得用户可以修改built-in widgets和create开发模块,但也存在错误创建或更新小部件的风险。 为确保成功创建或update图形原型小部件,请参考下方表格中列出的参数要求。
以下参数支持用于图形原型部件。
参数 | 仪表板小部件字段 | 名称 | 值 |
---|---|---|---|
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 | Graph prototype ID. 当来源设置为"图形原型"时,必须提供图形原型参数. |
Item prototype | 5 | itemid | Item prototype ID. 当来源设置为"简单图形原型"时,必须提供监控项原型参数. |
Show legend | 0 | show_legend | 0 - 禁用; 1 - (默认) 启用. |
Dynamic item | 0 | dynamic | 0 - (默认) 禁用; 1 - 启用. |
Columns | 0 | columns | 有效值范围为1-24. 默认: 2. |
Rows | 0 | rows | 有效值范围为1-16. 默认: 1. |
以下示例仅针对图形原型小部件的仪表板小部件字段objects的配置进行说明。 有关配置仪表板的更多信息,请参阅dashboard.create
。
配置一个图形原型部件,该部件显示由低级发现创建的监控项原型(ID: "42316")生成的3个图形网格(3列,1行)。
请求:
{
"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": 16,
"height": 5,
"view_mode": 0,
"fields": [
{
"type": 0,
"name": "source_type",
"value": 3
},
{
"type": 5,
"name": "itemid",
"value": 42316
},
{
"type": 0,
"name": "columns",
"value": 3
}
]
}
]
}
],
"userGroups": [
{
"usrgrpid": 7,
"permission": 2
}
],
"users": [
{
"userid": 1,
"permission": 3
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
响应: