更新

描述

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,此方法还接受以下参数。

ParameterTypeDescription
linksarrayMap links to replace the existing links. 拓扑图链接以替换现有的链接。
selementsarrayMap elements to replace the existing elements. 拓扑图元素替换成已存在的拓扑图元素
urlsarrayMap URLs to replace the existing URLs. 拓扑图URLs替换成已存在的URLs
usersarrayMap user shares to replace the existing elements. 拓扑图的共享用户替换成已存在的共享用户
userGroupsarrayMap user group shares to replace the existing elements. 拓扑图共享用户组替换成已存在的共享用户组
shapesarrayMap shapes to replace the existing shapes. 拓扑图图形替换成已存在的图形
linesarrayMap 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:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "map.update",
  4. "params": {
  5. "sysmapid": "8",
  6. "width": 1200,
  7. "height": 1200
  8. },
  9. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  10. "id": 1
  11. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "sysmapids": [
  5. "8"
  6. ]
  7. },
  8. "id": 1
  9. }

Change map owner 改变拓扑图的属组

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

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "map.update",
  4. "params": {
  5. "sysmapid": "9",
  6. "userid": "1"
  7. },
  8. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  9. "id": 2
  10. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": {
  4. "sysmapids": [
  5. "9"
  6. ]
  7. },
  8. "id": 2
  9. }

See also

Source

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