This is a translation of the original English documentation page. Help us make it better.

configuration.export

説明

string configuration.export(object parameters)

このメソッドは、設定データをシリアル化された文字列としてエクスポートすることができます。

このメソッドは、どのタイプのユーザーでも利用可能です。このメソッドを呼び出す許可は、ユーザーロール設定で
取り消すことができます。詳しくは User roles をご覧ください。

パラメータ

(object) エクスポートするオブジェクトとそのフォーマットを定義するパラメータ

パラメータ Type 説明
format
(required)
string Format in which the data must be exported.

Possible values:
yaml - YAML;
xml - XML;
json - JSON;
raw - unprocessed PHP array.
prettyprint boolean Make the output more human readable by adding indentation.

Possible values:
true - add indentation;
false - (default) do not add indentation.
options
(required)
object Objects to be exported.

The options object has the following parameters:
groups - (array) IDs of host groups to export;
hosts - (array) IDs of hosts to export;
images - (array) IDs of images to export;
maps - (array) IDs of maps to export;
mediaTypes - (array) IDs of media types to export;
templates - (array) IDs of templates to export.

戻り値

(string) 要求された設定データを含むシリアル化された文字列を返します。

ホスト設定のExport

ホストの設定をXML文字列としてエクスポートします。

Request:

{
           "jsonrpc": "2.0",
           "method": "configuration.export",
           "params": {
               "options": {
                   "hosts": [
                       "10161"
                   ]
               },
               "format": "xml"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<zabbix_export><version>5.4</version><date>2020-03-13T15:31:45Z</date><groups><group><uuid>6f6799aa69e844b4b3918f779f2abf08</uuid><name>Zabbix servers</name></group></groups><hosts><host><host>Export host</host><name>Export host</name><groups><group><name>Zabbix servers</name></group></groups><interfaces><interface><interface_ref>if1</interface_ref></interface></interfaces><items><item><name>Item</name><key>item.key</key><delay>30s</delay><tags><tag><tag>Application</tag><value>CPU</value></tag></tags><valuemap><name>Host status</name></valuemap><interface_ref>if1</interface_ref><request_method>POST</request_method></item></items><valuemaps><valuemap><name>Host status</name><mappings><mapping><value>0</value><newvalue>Up</newvalue></mapping><mapping><value>2</value><newvalue>Unreachable</newvalue></mapping></mappings></valuemap></valuemaps></host></hosts></zabbix_export>\n",
           "id": 1
       }

ソース

CConfiguration::export() は ui/include/classes/api/services/CConfiguration.php にあります。