host.massupdate

説明

object host.massupdate(object parameters)

このメソッドでは、複数のホストで同時に関連するオブジェクトの交換や削除、プロパティの更新を行うことができます。

このメソッドは、Admin および Super admin ユーザータイプにのみ使用できます。このメソッドを呼び出す許可は、
ユーザーロール設定で取り消すことができます。詳細については、User roles を参照してください。

パラメータ

(object) 更新するホストの ID と更新すべきプロパティを含むパラメータ

standard host propertiesに加えて、このメソッドは以下のパラメータを受け付けます。

パラメータ Type 説明
hosts
(required)
object/array Hosts to be updated.

The hosts must have the hostid property defined.
groups object/array Host groups to replace the current host groups the hosts belong to.

The host groups must have the groupid property defined.
interfaces object/array Host interfaces to replace the current host interfaces on the given hosts.
inventory object Host inventory properties.

Host inventory mode cannot be updated using the inventory parameter, use inventory_mode instead.
macros object/array User macros to replace the current user macros on the given hosts.
templates object/array Templates to replace the currently linked templates on the given hosts.

The templates must have the templateid property defined.
templates_clear object/array Templates to unlink and clear from the given hosts.

The templates must have the templateid property defined.

戻り値

(object) hostids プロパティの下で更新されたホストの ID を含むオブジェクトを返します。

複数ホストの監視を有効にする

2台のホストの監視を有効にする。(ステータスを0にする)

Request:

{
    "jsonrpc": "2.0",
    "method": "host.massupdate",
    "params": {
        "hosts": [
            {
                "hostid": "69665"
            },
            {
                "hostid": "69666"
            }
        ],
        "status": 0
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response:

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

参照

ソース

CHost::massUpdate() in ui/include/classes/api/services/CHost.php.