host.massremove

Description说明

object host.massremove(object parameters)

This method allows to remove related objects from multiple hosts.此方法允许从多个主机中移除相关对象。

Parameters参数

(object) Parameters containing the IDs of the hosts to update and the objects that should be removed.参数包含更新主机的ID和需要被移除的对象。

参数 类 说明
hostids
(required)
string/array IDs of the hosts to be updated.需要更新的主机ID。
groupids string/array Host groups to remove the given hosts from. 从指定的主机中移除主机组。
interfaces object/array Host interfaces to remove from the given hosts.从指定的主机中移除主机接口。

The host interface object must have the ip, dns and port properties defined. 主机接口对象必须已定义过ip,dns和port属性。
macros string/array User macros to delete from the given hosts. 从指定主机中删除用户宏。
templateids string/array Templates to unlink from the given hosts.从指定主机中删除模板链接。
templateids_clear string/array Templates to unlink and clear from the given hosts. 从指定主机中删除并清除模板链接。

Return values返回值

(object) Returns an object containing the IDs of the updated hosts under the hostids property.返回一个对象其中包含在hostids属性下已更新主机的ID。

Examples范例

Unlinking templates 删除模板链接

Unlink a template from two hosts and delete all of the templated entities.从两个主机中删除一个模板链接并且删除所有模板实体。

Request:

{
           "jsonrpc": "2.0",
           "method": "host.massremove",
           "params": {
               "hostids": ["69665", "69666"],
               "templateids_clear": "325"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "hostids": [
                   "69665",
                   "69666"
               ]
           },
           "id": 1
       }

See also参见

Source来源

CHost::massRemove() in frontends/php/include/classes/api/services/CHost.php.