2022 Zabbix中国峰会
2022 Zabbix中国峰会

graph.update

Description描述

object graph.update(object/array graphs)

This method allows to update existing graphs. 此方法允许更新已经存在的图形。

Parameters参数

(object/array) Graph properties to be updated. (关联数组/数组) 需要更新的图形参数。

The graphid property must be defined for each graph, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged. 图形 graphid 参数必须为每一张图形都被定义,所有其他的参数都是可选的。 只有传送的参数将被更新,其他的参数将保持不变。

Additionally to the standard graph properties the method accepts the following parameters. 标准图形参数外,此方法接受以下参数。

Parameter参数 T pe类型 Des ription描述
图形项 gitems ar ay 数组 Grap items to replace existing graph items. If a graph item has the gitemid property defined it will be updated, otherwise a new graph item will be created.图形项将替换现有的图形项。如果已经有一个图形项的“gitemid”参数被定义,那么它将被更新,否则将创建一个新的图形项。

Return values返回值

(object) Returns an object containing the IDs of the updated graphs under the graphids property. (关联数组object) 返回一个关联数组,包含更新图片的ID参数。

Examples示例

Setting the maximum for the Y scale设置Y轴最大值刻度

Set the the maximum of the Y scale to a fixed value of 100. 设置Y轴最大值刻度固定为100.

Request请求:

{
           "jsonrpc": "2.0",
           "method": "graph.update",
           "params": {
               "graphid": "439",
               "ymax_type": 1,
               "yaxismax": 100
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response响应:

{
           "jsonrpc": "2.0",
           "result": {
               "graphids": [
                   "439"
               ]
           },
           "id": 1
       }

Source来源

CGraph::update() in frontends/php/include/classes/api/services/CGraph.php.