object host.massadd(object parameters)
このメソッドでは、与えられたすべてのホストに、複数の関連オブジェクトを同時に追加することができます。
このメソッドは、Admin および Super admin ユーザータイプにのみ使用できます。このメソッドを呼び出す許可は、
ユーザーロール設定で取り消すことができます。詳細については、User roles を参照してください。
(object)
更新するホストのID、および全てのホストに追加するオブジェクトを含むパラメータ
このメソッドは、以下のパラメータを受け付けます。
パラメータ | Type | 説明 |
---|---|---|
hosts (required) | object/array | Hosts to be updated. The hosts must have the hostid property defined. |
groups | object/array | Host groups to add to the given hosts. The host groups must have the groupid property defined. |
interfaces | object/array | Host interfaces to be created for the given hosts. |
macros | object/array | User macros to be created for the given hosts. |
templates | object/array | Templates to link to the given hosts. The templates must have the templateid property defined. |
(object)
hostids
プロパティの下で更新されたホストの ID を含むオブジェクトを返します。
2つのホストに2つの新しいマクロを追加します。
Request:
{ "jsonrpc": "2.0", "method": "host.massadd", "params": { "hosts": [ { "hostid": "10160" }, { "hostid": "10167" } ], "macros": [ { "macro": "{$TEST1}", "value": "MACROTEST1" }, { "macro": "{$TEST2}", "value": "MACROTEST2", "description": "Test description" } ] }, "auth": "038e1d7b1735c6a5436ee9eae095879e", "id": 1 }
Response:
CHost::massAdd() in ui/include/classes/api/services/CHost.php.