configuration.export

Description

string configuration.export(object **parameters**)

This method allows to export configuration data as a serialized string.

This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.

Parameters

(object) Parameters defining the objects to be exported and the format to use.

ParameterTypeDescription
format
(required)
stringFormat in which the data must be exported.

Possible values:
yaml - YAML;
xml - XML;
json - JSON.
prettyprintbooleanMake the output more human readable by adding indentation.

Possible values:
true - add indentation;
false - (default) do not add indentation.
options
(required)
objectObjects 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;
screens - (array) IDs of screens to export;
templates - (array) IDs of templates to export;
valueMaps - (array) IDs of value maps to export.

Return values

(string) Returns a serialized string containing the requested configuration data.

Examples

Exporting a host

Export the configuration of a host as an XML string.

Request:

  1. {
  2. "jsonrpc": "2.0",
  3. "method": "configuration.export",
  4. "params": {
  5. "options": {
  6. "hosts": [
  7. "10161"
  8. ]
  9. },
  10. "format": "xml"
  11. },
  12. "auth": "038e1d7b1735c6a5436ee9eae095879e",
  13. "id": 1
  14. }

Response:

  1. {
  2. "jsonrpc": "2.0",
  3. "result": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<zabbix_export><version>5.2</version><date>2020-03-13T15:31:45Z</date><groups><group><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><applications><application><name>Application</name></application></applications><items><item><name>Item</name><key>item.key</key><delay>30s</delay><applications><application><name>Application</name></application></applications><valuemap><name>Host status</name></valuemap><interface_ref>if1</interface_ref><request_method>POST</request_method></item></items></host></hosts><value_maps><value_map><name>Host status</name><mappings><mapping><value>0</value><newvalue>Up</newvalue></mapping><mapping><value>2</value><newvalue>Unreachable</newvalue></mapping></mappings></value_map></value_maps></zabbix_export>\n",
  4. "id": 1
  5. }

Source

CConfiguration::export() in ui/include/classes/api/services/CConfiguration.php.