This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

template.massadd

説明

object template.massadd(object parameters)

このメソッドで、指定されたテンプレートに複数の関連オブジェクトを同時に追加できます。

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

パラメータ

(object) 更新するテンプレートの ID とテンプレートに追加するオブジェクトを含むパラメーター

このメソッドは、次のパラメーターを受け入れます

パラメータ タイプ 説明
templates
(必須)
object/array 更新するテンプレート。

テンプレートには templateid プロパティが定義されている必要があります。
groups object/array 指定されたテンプレートを追加するホスト グループ。

ホスト グループにはgroupidプロパティが定義されている必要があります。
macros object/array 指定されたテンプレート用に作成されるユーザー マクロ。
templates_link object/array 指定されたテンプレートにリンクするテンプレート。

テンプレートには templateid プロパティが定義されている必要があります。

戻り値

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

グループをテンプレートにリンクする

2 つのテンプレートにホスト グループ"2"を追加します。

Request:

{
           "jsonrpc": "2.0",
           "method": "template.massadd",
           "params": {
               "templates": [
                   {
                       "templateid": "10085"
                   },
                   {
                       "templateid": "10086"
                   }
               ],
               "groups": [
                   {
                       "groupid": "2"
                   }
               ]
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10085",
                   "10086"
               ]
           },
           "id": 1
       }

Link templates "10106" and "10104" to template "10073".

Request:

{
           "jsonrpc": "2.0",
           "method": "template.massadd",
           "params": {
               "templates": [
                   {
                       "templateid": "10073"
                   }
               ],
               "templates_link": [
                   {
                       "templateid": "10106"
                   },
                   {
                       "templateid": "10104"
                   }
               ]
           },
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10073"
               ]
           },
           "id": 1
       }

参照

ソース

CTemplate::massAdd() in ui/include/classes/api/services/CTemplate.php.