object map.create(object/array maps)
这个方法允许创建一个新的拓扑图
此方法适用于任何类型的用户. 调用该方法的权限可以在用户角色设置中撤销. 请参阅用户角色了解更多信息.
(object/array)
要创建的拓扑图。
除了标准拓扑图属性外,该方法还接受以下参数
参数 | 类型 | 说明 |
---|---|---|
links | array | 要在拓扑图上创建的拓扑图 links。 |
selements | array | 要在拓扑图上创建的拓扑图 元素。 |
urls | array | 要在拓扑图上创建的拓扑图 URLs。 |
users | array | 要在拓扑图上创建的拓扑图共享 user 。 |
userGroups | array | 要在拓扑图上创建的拓扑图 用户组 共享。 |
shapes | array | 要在拓扑图上创建的拓扑图 shapes。 |
lines | array | 要在拓扑图上创建的拓扑图 lines。 |
:::noteclassic 要创建地图链接,您需要将地图元素 selementid 设置为任意值,然后使用此值在链接 selementid1 或 selementid2 属性中引用此元素。 创建元素时,该值将替换为 Zabbix 生成的正确 ID, 参考 :::
(对象)
返回一个对象,该对象包含在"sysmapid"属性下创建的拓扑图的id。返回id的顺序与传递的拓扑图的顺序相匹配。
创建一个没有任何元素的拓扑图
请求:
{ "jsonrpc": "2.0", "method": "map.create", "params": { "name": "Map", "width": 600, "height": 600 }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }
响应:
创建一个包含两个主机元素和它们之间链接的拓扑图。 请注意在拓扑图链接对象中使用临时“selementid1”和“selementid2”值来引用拓扑图元素。
请求:
{ "jsonrpc": "2.0", "method": "map.create", "params": { "name": "Host map", "width": 600, "height": 600, "selements": [ { "selementid": "1", "elements": [ {"hostid": "1033"} ], "elementtype": 0, "iconid_off": "2" }, { "selementid": "2", "elements": [ {"hostid": "1037"} ], "elementtype": 0, "iconid_off": "2" } ], "links": [ { "selementid1": "1", "selementid2": "2" } ] }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }
响应:
创建一个包含两个触发器元素的拓扑图。
请求:
{ "jsonrpc": "2.0", "method": "map.create", "params": { "name": "Trigger map", "width": 600, "height": 600, "selements": [ { "elements": [ {"triggerid": "12345"}, {"triggerid": "67890"} ], "elementtype": 2, "iconid_off": "2" } ] }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }
响应:
创建具有两种共享类型(用户和用户组)的拓扑图。
请求:
{ "jsonrpc": "2.0", "method": "map.create", "params": { "name": "Map sharing", "width": 600, "height": 600, "users": [ { "userid": "4", "permission": "3" } ], "userGroups": [ { "usrgrpid": "7", "permission": "2" } ] }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }
响应:
创建一个带有主题的拓扑图
请求:
{ "jsonrpc": "2.0", "method": "map.create", "params": { "name": "Host map", "width": 600, "height": 600, "shapes": [ { "type": 0, "x": 0, "y": 0, "width": 600, "height": 11, "text": "{MAP.NAME}" } ] }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }
响应:
创建拓扑图线。
请求:
{ "jsonrpc": "2.0", "method": "map.create", "params": { "name": "Map API lines", "width": 500, "height": 500, "lines": [ { "x1": 30, "y1": 10, "x2": 100, "y2": 50, "line_type": 1, "line_width": 10, "line_color": "009900" } ] }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }
响应:
CMap::create() in ui/include/classes/api/services/CMap.php.