string configuration.export(object parameters)
This method allows to export configuration data as a serialized string.
(object)
Parameters defining the objects to be exported and the format to use.
Parameter | Type | Description |
---|---|---|
format (required) |
string | Format in which the data must be exported. Possible values: json - JSON;xml - XML. |
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;screens - (array) IDs of screens to export;templates - (array) IDs of templates to export;valueMaps - (array) IDs of value maps to export. |
(string)
Returns a serialized string containing the requested configuration data.
Export the configuration of template "10571" as an XML string.
Request:
{
"jsonrpc": "2.0",
"method": "configuration.export",
"params": {
"options": {
"templates": [
"10571"
]
},
"format": "xml"
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<zabbix_export><version>5.0</version><date>2020-01-01T12:00:00Z</date><groups><group><name>Templates</name></group></groups><templates><template><template>New template</template><name>New template</name><groups><group><name>Templates</name></group></groups><applications><application><name>Apache</name></application><application><name>CPU</name></application><application><name>Zabbix server</name></application></applications><items><item><name>Zabbix agent ping</name><key>agent.ping</key><applications><application><name>Zabbix server</name></application></applications><valuemap><name>Zabbix agent ping</name></valuemap></item><item><name>Apache server uptime</name><type>DEPENDENT</type><key>apache.server.uptime</key><delay>0</delay><trends>0</trends><value_type>TEXT</value_type><applications><application><name>Apache</name></application></applications><preprocessing><step><type>REGEX</type><params><dt>Server uptime: (.*)</dt>\n\\1</params></step></preprocessing><master_item><key>web.page.get[127.0.0.1/server-status]</key></master_item></item><item><name>CPU load</name><key>system.cpu.load</key><value_type>FLOAT</value_type><applications><application><name>CPU</name></application></applications><triggers><trigger><expression>{avg(3m)}>2</expression><name>CPU load too high on 'New host' for 3 minutes</name><priority>WARNING</priority></trigger></triggers></item><item><name>Apache server status</name><key>web.page.get[127.0.0.1/server-status]</key><trends>0</trends><value_type>TEXT</value_type><applications><application><name>Apache</name></application></applications></item></items></template></templates><value_maps><value_map><name>Zabbix agent ping</name><mappings><mapping><value>0</value><newvalue>Not available</newvalue></mapping><mapping><value>1</value><newvalue>Available</newvalue></mapping></mappings></value_map></value_maps></zabbix_export>\n",
"id": 1
}
CConfiguration::export() in ui/include/classes/api/services/CConfiguration.php.