You are viewing documentation for the development version, it may be incomplete.
Join our translation project and help translate Zabbix documentation into your native language.

template.massupdate

説明

object template.massupdate(object parameters)

このメソッドは、複数のテンプレートに関連するオブジェクトを同時に置換または削除し、プロパティを更新することができます。

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

パラメータ

(object) 更新するテンプレートのIDとテンプレートの置換対象オブジェクトを含むパラメータ。

このメソッドは以下のパラメータを受け付けます。

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

テンプレートにはtemplateidプロパティのみを定義する必要があります。

パラメータの動作:
- 必須
groups object/array テンプレートが属する現在のテンプレートグループを置き換えるテンプレートグループ

テンプレートグループにはgroupidプロパティのみを定義する必要があります。
macros object/array 指定したテンプレートの現在のユーザーマクロをすべて置き換えるユーザーマクロ
templates_clear object/array 指定したテンプレートからリンク解除およびクリアするテンプレート

テンプレートにはtemplateidプロパティのみを定義する必要があります。
templates_link object/array 現在リンクされているテンプレートを置き換えるテンプレート

テンプレートにはtemplateidプロパティのみを定義する必要があります。

戻り値

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

テンプレートのリンク解除

指定されたテンプレートからテンプレート"10091"のリンクを解除してクリアします。

リクエスト:

{
           "jsonrpc": "2.0",
           "method": "template.massupdate",
           "params": {
               "templates": [
                   {
                       "templateid": "10085"
                   },
                   {
                       "templateid": "10086"
                   }
               ],
               "templates_clear": [
                   {
                       "templateid": "10091"
                   }
               ]
           },
           "id": 1
       }

Response:

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

ユーザーマクロの置換

複数のテンプレートで、すべてのユーザーマクロを指定したユーザーマクロに置き換えます。

リクエスト:

{
           "jsonrpc": "2.0",
           "method": "template.massupdate",
           "params": {
               "templates": [
                   {
                       "templateid": "10074"
                   },
                   {
                       "templateid": "10075"
                   },
                   {
                       "templateid": "10076"
                   },
                   {
                       "templateid": "10077"
                   }
               ],
               "macros": [
                   {
                       "macro": "{$AGENT.TIMEOUT}",
                       "value": "5m",
                       "description": "Timeout after which agent is considered unavailable. Works only for agents reachable from Zabbix server/proxy (passive mode)."
                   }
               ]
           },
           "id": 1
       }

レスポンス:

{
           "jsonrpc": "2.0",
           "result": {
               "templateids": [
                   "10074",
                   "10075",
                   "10076",
                   "10077"
               ]
           },
           "id": 1
       }

関連項目

ソース

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