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.

usermacro.update

説明

object usermacro.update(object/array hostMacros)

このメソッドを使用すると、既存のホスト マクロを更新できます。

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

パラメータ

(object/array) 更新するホストマクロプロパティ

ホスト マクロごとにhostmacroidプロパティを定義する必要があります。他のプロパティはすべてオプションです。 渡されたプロパティのみが更新され、他のプロパティは変更されません。

戻り値

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

ホストマクロの値変更

ホストマクロの値を"public"に変更します。

Request:

{  "jsonrpc": "2.0",  "method": "usermacro.update",  "params": {  "hostmacroid": "1",  "value": "public"  },  "auth": "038e1d7b1735c6a5436ee9eae095879e",  "id": 1 }

Response:

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

Change macro value that was created by discovery rule

Convert discovery rule created "automatic" macro to "manual" and change its value to "new-value".

Request:

{  "jsonrpc": "2.0",  "method": "usermacro.update",  "params": {  "hostmacroid": "1",  "value": "new-value",  "automatic": "0"  },  "auth": "038e1d7b1735c6a5436ee9eae095879e",  "id": 1 }

Response:

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

ソース

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