获取

描述

integer/array map.get(object parameters)

此方法允许根据给定参数检索符合条件的拓扑图。

此方法适用于任何类型的用户。调用该方法的权限可以在用户角色设置中撤销。 请参阅用户角色了解更多信息。

参数

(object) 定义所需输出的参数。

该方法支持以下参数。

参数 类型 描述
sysmapids ID/数组 仅返回具有给定ID的地图。
userids ID/数组 仅返回属于给定用户ID的地图。
expandUrls 标志 向对应的地图元素添加全局地图URL,并在所有地图元素URL中扩展宏。
selectIconMap 查询 返回一个iconmap属性,其中包含在地图上使用的图标地图。
selectLinks 查询 返回一个links属性,其中包含地图元素之间的地图链接。
selectSelements 查询 返回一个selements属性,其中包含地图元素。
selectUrls 查询 返回一个urls属性,其中包含地图URL。
selectUsers 查询 返回一个users属性,其中包含与地图共享的用户。
selectUserGroups 查询 返回一个userGroups属性,其中包含与地图共享的用户组。
selectShapes 查询 返回一个shapes属性,其中包含地图形状。
selectLines 查询 返回一个lines属性,其中包含地图线条。
sortfield 字符串/数组 根据给定属性对结果进行排序。

可能的值:namewidthheight
countOutput 布尔值 这些参数在参考说明中描述。
editable 布尔值
excludeSearch 布尔值
filter 对象
limit 整数
output 查询
preservekeys 布尔值
search 对象
searchByAny 布尔值
searchWildcardsEnabled 布尔值
sortorder 字符串/数组
startSearch 布尔值

返回值

(整型/数组) 返回其中之一:

  • 一个对象数组;
  • 如果使用countOutput参数,查询对象的数量.

案例

查询拓扑图

查询有关拓扑图"3"的所有数据。

请求

{
           "jsonrpc": "2.0",
           "method": "map.get",
           "params": {
               "output": "extend",
               "selectSelements": "extend",
               "selectLinks": "extend",
               "selectUsers": "extend",
               "selectUserGroups": "extend",
               "selectShapes": "extend",
               "selectLines": "extend",
               "sysmapids": "3"
           },
           "id": 1
       }

响应:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "selements": [
                       {
                           "selementid": "10",
                           "sysmapid": "3",
                           "elementtype": "4",
                           "evaltype": "0",
                           "iconid_off": "1",
                           "iconid_on": "0",
                           "label": "Zabbix server",
                           "label_location": "3",
                           "x": "11",
                           "y": "141",
                           "iconid_disabled": "0",
                           "iconid_maintenance": "0",
                           "elementsubtype": "0",
                           "areatype": "0",
                           "width": "200",
                           "height": "200",
                           "tags": [
                               {
                                   "tag": "service",
                                   "value": "mysqld",
                                   "operator": "0"
                               }
                           ],
                           "viewtype": "0",
                           "use_iconmap": "1",
                           "urls": [],
                           "elements": []
                       },
                       {
                           "selementid": "11",
                           "sysmapid": "3",
                           "elementtype": "4",
                           "evaltype": "0",
                           "iconid_off": "1",
                           "iconid_on": "0",
                           "label": "Web server",
                           "label_location": "3",
                           "x": "211",
                           "y": "191",
                           "iconid_disabled": "0",
                           "iconid_maintenance": "0",
                           "elementsubtype": "0",
                           "areatype": "0",
                           "width": "200",
                           "height": "200",
                           "viewtype": "0",
                           "use_iconmap": "1",
                           "tags": [],
                           "urls": [],
                           "elements": []
                       },
                       {
                           "selementid": "12",
                           "sysmapid": "3",
                           "elementtype": "0",
                           "evaltype": "0",
                           "iconid_off": "185",
                           "iconid_on": "0",
                           "label": "{HOST.NAME}\r\n{HOST.CONN}",
                           "label_location": "0",
                           "x": "111",
                           "y": "61",
                           "iconid_disabled": "0",
                           "iconid_maintenance": "0",
                           "elementsubtype": "0",
                           "areatype": "0",
                           "width": "200",
                           "height": "200",
                           "viewtype": "0",
                           "use_iconmap": "0",
                           "tags": [],
                           "urls": [],
                           "elements": [
                               {
                                   "hostid": "10084"
                               }
                           ]
                       }
                   ],
                   "links": [
                       {
                           "linkid": "23",
                           "sysmapid": "3",
                           "selementid1": "10",
                           "selementid2": "11",
                           "drawtype": "0",
                           "color": "00CC00",
                           "label": "",
                           "linktriggers": []
                       }
                   ],
                   "users": [
                       {
                           "sysmapuserid": "1",
                           "userid": "2",
                           "permission": "2"
                       }
                   ],
                   "userGroups": [
                       {
                           "sysmapusrgrpid": "1",
                           "usrgrpid": "7",
                           "permission": "2"
                       }
                   ],
                   "shapes":[
                       {
                           "sysmap_shapeid":"1",
                           "type":"0",
                           "x":"0",
                           "y":"0",
                           "width":"680",
                           "height":"15",
                           "text":"{MAP.NAME}",
                           "font":"9",
                           "font_size":"11",
                           "font_color":"000000",
                           "text_halign":"0",
                           "text_valign":"0",
                           "border_type":"0",
                           "border_width":"0",
                           "border_color":"000000",
                           "background_color":"",
                           "zindex":"0"
                       }
                   ],
                   "lines":[
                       {
                           "sysmap_shapeid":"2",
                           "x1": 30,
                           "y1": 10,
                           "x2": 100,
                           "y2": 50,
                           "line_type": 1,
                           "line_width": 10,
                           "line_color": "009900",
                           "zindex":"1"
                       }
                   ],
                   "sysmapid": "3",
                   "name": "Local network",
                   "width": "400",
                   "height": "400",
                   "backgroundid": "0",
                   "label_type": "2",
                   "label_location": "3",
                   "highlight": "1",
                   "expandproblem": "1",
                   "markelements": "0",
                   "show_unack": "0",
                   "grid_size": "50",
                   "grid_show": "1",
                   "grid_align": "1",
                   "label_format": "0",
                   "label_type_host": "2",
                   "label_type_hostgroup": "2",
                   "label_type_trigger": "2",
                   "label_type_map": "2",
                   "label_type_image": "2",
                   "label_string_host": "",
                   "label_string_hostgroup": "",
                   "label_string_trigger": "",
                   "label_string_map": "",
                   "label_string_image": "",
                   "iconmapid": "0",
                   "expand_macros": "0",
                   "severity_min": "0",
                   "userid": "1",
                   "private": "1",
                   "show_suppressed": "1"
               }
           ],
           "id": 1
       }

查看相关

来源

CMap::get() in ui/include/classes/api/services/CMap.php.