Zabbix Documentation 3.4

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


Sidebar

zh:manual:api:reference:hostgroup:update

hostgroup.update

Description 说明

object hostgroup.update(object/array hostGroups)

This method allows to update existing hosts groups.此方法允许更新现有的主机组。

Parameters 参数

(object/array) Host group properties to be updated. 要更新的主机组属性。

The groupid property must be defined for each host group, all other properties are optional. Only the given properties will be updated, all others will remain unchanged.必须为每个主机组定义“groupid”属性,所有其他属性都是可选的。只有给定的属性将被更新,所有其他属性将保持不变。

Return values 返回值

(object) Returns an object containing the IDs of the updated host groups under the groupids property.返回包含“groupids”属性下更新的主机组的ID的对象。

Examples 示例

Renaming a host group 重命名主机组

Rename a host group to “Linux hosts.”将主机组命名为“Linux主机”。

Request:

{
    "jsonrpc": "2.0",
    "method": "hostgroup.update",
    "params": {
        "groupid": "7",
        "name": "Linux hosts"
    },
    "auth": "700ca65537074ec963db7efabda78259",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "groupids": [
            "7"
        ]
    },
    "id": 1
}

Source来源

CHostGroup::update() in frontends/php/include/classes/api/services/CHostGroup.php.