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

application.massadd

说明

object application.massadd(object parameters)

此方法用于同时添加多个监控项到指定的应用集。

参数

(object) 参数包含更新应用集和加入应用集监控项的 ID。

该方法接受以下参数。

参数 类 说明
applications
(required)
array/object 需要更新的应用集。

应用集必须已定义好 applicationeid 属性。
items array/object 监控项加入到指定的应用集。

监控项必须已定义好 itemid属性。

返回值

(object) 返回一个其中在 applicationid 属性下已更新应用集的 ID 的对象。

范例

添加监控项到多个应用集。

添加指定的监控项到两个应用集。

请求:

{
           "jsonrpc": "2.0",
           "method": "application.massadd",
           "params": {
               "applications": [
                   {
                       "applicationid": "247"
                   },
                   {
                       "applicationid": "246"
                   }
               ],
               "items": [
                   {
                       "itemid": "22800"
                   },
                   {
                       "itemid": "22801"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

响应:

{
           "jsonrpc": "2.0",
           "result": {
               "applicationids": [
                   "247",
                   "246"
               ]
           },
           "id": 1
       }

参见

来源

CApplication::massAdd() in frontends/php/include/classes/api/services/CApplication.php.

Description

object application.massadd(object parameters)

This method allows to simultaneously add multiple items to the given applications.

Parameters

(object) Parameters containing the IDs of the applications to update and the items to add to the applications.

The method accepts the following parameters.

Parameter Type Description
applications
(required)
array/object Applications to be updated.

The applications must have the applicationid property defined.
items array/object Items to add to the given applications.

The items must have the itemid property defined.

Return values

(object) Returns an object containing the IDs of the updated applications under the applicationids property.

Examples

Adding items to multiple applications

Add the given items to two applications.

Request:

{
           "jsonrpc": "2.0",
           "method": "application.massadd",
           "params": {
               "applications": [
                   {
                       "applicationid": "247"
                   },
                   {
                       "applicationid": "246"
                   }
               ],
               "items": [
                   {
                       "itemid": "22800"
                   },
                   {
                       "itemid": "22801"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "applicationids": [
                   "247",
                   "246"
               ]
           },
           "id": 1
       }

See also

Source

CApplication::massAdd() in frontends/php/include/classes/api/services/CApplication.php.