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

iconmap.create

Description 说明

object iconmap.create(object/array iconMaps)

This method allows to create new icon maps.此方法允许创建新的图标拓扑图。

Parameters参数

(object/array) Icon maps to create.需要创建的图标拓扑图。

Additionally to the standard icon map properties, the method accepts the following parameters.另外,对于标准图标拓扑图属性,此方法接受以下参数。

参数 类 说明
mappings
(required)
array Icon mappings to be created for the icon map.为图标拓扑图所创建的图标映射。

Return values 返回值

(object) Returns an object containing the IDs of the created icon maps under the iconmapids property. The order of the returned IDs matches the order of the passed icon maps.返回一个对象其中包含在iconmapids属性下已创建图标拓扑图的ID。返回ID的命令与传递图标拓扑图的命令匹配。

Examples范例

Create an icon map创建一个图标拓扑图

Create an icon map to display hosts of different types.创建一个图标拓扑图来显示不同类型的主机。

Request:

{
           "jsonrpc": "2.0",
           "method": "iconmap.create",
           "params": {
               "name": "Type icons",
               "default_iconid": "2",
               "mappings": [
                   {
                       "inventory_link": 1,
                       "expression": "server",
                       "iconid": "3"
                   },
                   {
                       "inventory_link": 1,
                       "expression": "switch",
                       "iconid": "4"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "iconmapids": [
                   "2"
               ]
           },
           "id": 1
       }

See also 参见

Source来源

CIconMap::create() in frontends/php/include/classes/api/services/CIconMap.php.