object graph.create(object/array graphs)
此方法用于 create 新图表。
此方法仅对 Admin 和 Super admin 用户类型可用。调用该方法的权限可以在用户角色设置中撤销。更多信息请参阅 User roles 。
(object/array)
要创建的图表。
除了 图表 之外, 该方法还接受以下参数。
参数 | 数据类型 | 说明 |
---|---|---|
gitems | array | 为该图表创建的Graph items。 参数行为: - 必填 |
(object)
返回一个 object,其中包含创建的图形的 ID, 这些 ID 位于 graphids
属性下。返回的 ID 顺序与传入的图形顺序一致。
创建一个包含两个 监控项 的图表。
执行请求:
{
"jsonrpc": "2.0",
"method": "graph.create",
"params": {
"name": "MySQL bandwidth",
"width": 900,
"height": 200,
"gitems": [
{
"itemid": "22828",
"color": "00AA00"
},
{
"itemid": "22829",
"color": "3333FF"
}
]
},
"id": 1
}
响应:
CGraph::create() 在 ui/include/classes/api/services/CGraph.php 中。