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.

itemprototype.update

説明

object itemprototype.update(object/array itemPrototypes)

このメソッドは、既存のアイテムプロトタイプを更新するためのものです。

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

パラメータ

(object/array) 更新するアイテムプロトタイプのプロパティ。

各アイテムプロトタイプには itemid プロパティを定義する必要があり、他のすべてのプロパティはオプションです。 渡されたプロパティのみが更新され、他のすべては変更されません。

標準のアイテムプロトタイプのプロパティに加えて、このメソッドは以下のパラメータを受け付けます。

パラメータ 説明
preprocessing array 現在の前処理オプションを置き換えるアイテムプロトタイプの前処理オプション。

パラメータの動作:
- 継承されたオブジェクトの場合は読み取り専用
tags array アイテムプロトタイプのタグ

戻り値

(object) itemids プロパティの下で更新されたアイテム プロトタイプの ID を含むオブジェクトを返します。

アイテムプロトタイプのインターフェースの変更

検出されたアイテムで使用するホストインターフェースを変更します。

リクエスト:

{
           "jsonrpc": "2.0",
           "method": "itemprototype.update",
           "params": {
               "itemid": "27428",
               "interfaceid": "132"
           },
           "id": 1
       }

レスポンス:

{
           "jsonrpc": "2.0",
           "result": {
               "itemids": [
                   "27428"
               ]
           },
           "id": 1
       }

従属アイテムプロトタイプの更新

新しいマスターアイテムプロトタイプIDで従属アイテムプロトタイプを更新します。同じホスト(テンプレート/ディスカバリールール)でのみ依存関係が許可されるため、マスターと従属アイテムは同じhostidおよびruleidを持つ必要があります。

リクエスト:

{
           "jsonrpc": "2.0",
           "method": "itemprototype.update",
           "params": {
               "master_itemid": "25570",
               "itemid": "189030"
           },
           "id": 1
       }

レスポンス:

{
           "jsonrpc": "2.0",
           "result": {
               "itemids": [
                   "189030"
               ]
           },
           "id": 1
       }

HTTPエージェントアイテムプロトタイプの更新

クエリフィールドを変更し、すべてのカスタムヘッダーを削除します。

リクエスト:

{
           "jsonrpc": "2.0",
           "method": "itemprototype.update",
           "params": {
               "itemid":"28305",
               "query_fields": [
                   {
                       "name": "random",
                       "value": "qwertyuiopasdfghjklzxcvbnm"
                   }
               ],
               "headers": []
           }
           "id": 1
       }

レスポンス:

{
           "jsonrpc": "2.0",
           "result": {
               "itemids": [
                   "28305"
               ]
           },
           "id": 1
       }

アイテムの事前処理オプションの更新

アイテムプロトタイプをアイテム事前処理ルール「カスタム乗数」で更新します。

リクエスト:

{
           "jsonrpc": "2.0",
           "method": "itemprototype.update",
           "params": {
               "itemid": "44211",
               "preprocessing": [
                   {
                       "type": 1,
                       "params": "4",
                       "error_handler": 2,
                       "error_handler_params": "5"
                   }
               ]
           },
           "id": 1
       }

レスポンス:

{
           "jsonrpc": "2.0",
           "result": {
               "itemids": [
                   "44211"
               ]
           },
           "id": 1
       }

スクリプトアイテムプロトタイプの更新

異なるスクリプトでスクリプトアイテムプロトタイプを更新し、以前のスクリプトで使用されていた不要なパラメータを削除します。

リクエスト:

{
           "jsonrpc": "2.0",
           "method": "itemprototype.update",
           "params": {
               "itemid": "23865",
               "parameters": [],
               "script": "Zabbix.log(3, 'Log test');\nreturn 1;"
           },
           "id": 1
       }

レスポンス:

{
           "jsonrpc": "2.0",
           "result": {
               "itemids": [
                   "23865"
               ]
           },
           "id": 1
       }

ソース

CItemPrototype::update() in ui/include/classes/api/services/CItemPrototype.php.