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

更新

描述

object map.update(object/array maps)

This method allows to update existing maps. 此方法可以用来更新已存在的拓扑图

Parameters 参数

(object/array) Map properties to be updated. (object/array) 更新拓扑图参数

The mapid property must be defined for each map, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged. mapid属性必须在每个拓扑图中定义,其他的属性是可选择的。只有传递的参数会被更新,其他的参数将会保持不变。

Additionally to the standard map properties, the method accepts the following parameters. 除了standard map properties,此方法还接受以下参数。

Parameter Type Description
links array Map links to replace the existing links. 拓扑图链接以替换现有的链接。
selements array Map elements to replace the existing elements. 拓扑图元素替换成已存在的拓扑图元素
urls array Map URLs to replace the existing URLs. 拓扑图URLs替换成已存在的URLs
users array Map user shares to replace the existing elements. 拓扑图的共享用户替换成已存在的共享用户
userGroups array Map user group shares to replace the existing elements. 拓扑图共享用户组替换成已存在的共享用户组
shapes array Map shapes to replace the existing shapes. 拓扑图图形替换成已存在的图形
lines array Map lines to replace the existing lines. 图谱图的连线替换成已存在的连线

To create map links between new map elements you'll need to set an elements selementid to an arbitrary value and then use this value to reference this element in the links selementid1 or selementid2 properties. When the element is created, this value will be replaced with the correct ID generated by Zabbix. See example for map.create. ::: <note tip>要在新的拓扑图元素之间创建映射链接,您需要将一个元素设置为一个任意的值,然后使用这个值在链接selemand1selemand2属性中引用这个元素。在创建元素时,将用Zabbix生成的正确ID替换该值。See example for map.create.

Return values 返回值

(object) Returns an object containing the IDs of the updated maps under the sysmapids property. (object) 返回一个对象,该对象包含“sysmapid”属性下更新的映射的id。

Examples 示例如下

Resize a map 调整拓扑图的大小

Change the size of the map to 1200x1200 pixels. 改变拓扑图的大小为1200*1200,单位是像素。

Request:

{
           "jsonrpc": "2.0",
           "method": "map.update",
           "params": {
               "sysmapid": "8",
               "width": 1200,
               "height": 1200
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "sysmapids": [
                   "8"
               ]
           },
           "id": 1
       }

Change map owner 改变拓扑图的属组

Available only for admins and super admins. 仅适用于管理员和超级管理员

Request:

{
           "jsonrpc": "2.0",
           "method": "map.update",
           "params": {
               "sysmapid": "9",
               "userid": "1"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 2
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "sysmapids": [
                   "9"
               ]
           },
           "id": 2
       }

See also

Source

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