Media types are exported with all related objects and object relations.
To export media types, do the following:
Selected media types are exported to a local XML file with default name zbx_export_mediatypes.xml.
To import media types, do the following:
A success or failure message of the import will be displayed in the frontend.
Import rules:
Rule | Description |
---|---|
Update existing | Existing elements will be updated with data taken from the import file. Otherwise they will not be updated. |
Create new | The import will add new elements using data from the import file. Otherwise it will not add them. |
Delete missing | The import will remove existing elements not present in the import file. Otherwise it will not remove them. |
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<date>2020-01-24T06:44:38Z</date>
<media_types>
<media_type>
<name>Slack chat</name>
<type>WEBHOOK</type>
<parameters>
<parameter>
<name>channel</name>
<value>{ALERT.SENDTO}</value>
</parameter>
<parameter>
<name>text</name>
<value>{ALERT.MESSAGE}</value>
</parameter>
<parameter>
<name>username</name>
<value>bot</value>
</parameter>
</parameters>
<script>var req = new CurlHttpRequest();
req.AddHeader('Content-Type: application/x-www-form-urlencoded');
Zabbix.Log(127, 'webhook requqest value='+value);
req.Post('https://hooks.slack.com/services/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',
'payload='+value
);
Zabbix.Log(127, 'response code: '+req.Status());
return JSON.stringify({
'tags': {
'delivered': 'slack'
}
});</script>
<process_tags>YES</process_tags>
<show_event_menu>YES</show_event_menu>
<event_menu_url>https://www.zabbix.com</event_menu_url>
<event_menu_name>Slack message</event_menu_name>
<description>Slack chat messages.</description>
</media_type>
</media_types>
</zabbix_export>
Element tag values are explained in the table below.
Element | Element property | Required | Type | Range1 | Description |
---|---|---|---|---|---|
media_types | - | Root element for media_types. | |||
media_type | - | Individual media_type. | |||
name | x | string |
Media type name. | ||
type | x | string |
0 - EMAIL 1 - SMS 2 - SCRIPT 4 - WEBHOOK |
Transport used by the media type. | |
status | - | string |
0 - ENABLED (default) 1 - DISABLED |
Whether the media type is enabled. | |
max_sessions | - | integer |
Possible values for SMS: 1 - (default) Possible values for other media types: 0-100, 0 - unlimited |
The maximum number of alerts that can be processed in parallel. | |
attempts | - | integer |
1-10 (default: 3) | The maximum number of attempts to send an alert. | |
attempt_interval | - | string |
0-60s (default: 10s) | The interval between retry attempts. Accepts seconds and time unit with suffix. |
|
description | - | string |
Media type description. | ||
message_templates | - | Root element for media type message templates. | |||
message_template | - | Individual message template. | |||
event_source | x | string |
0 - TRIGGERS 1 - DISCOVERY 2 - AUTOREGISTRATION 3 - INTERNAL |
Event source. | |
operation_mode | x | string |
0 - PROBLEM 1 - RECOVERY 2 - UPDATE |
Operation mode. | |
subject | - | string |
Message subject. | ||
message | - | string |
Message body. | ||
Used only by e-mail media type | |||||
smtp_server | x | string |
SMTP server. | ||
smtp_port | - | integer |
Default: 25 | SMTP server port to connect to. | |
smtp_helo | x | string |
SMTP helo. | ||
smtp_email | x | string |
Email address from which notifications will be sent. | ||
smtp_security | - | string |
0 - NONE (default) 1 - STARTTLS 2 - SSL_OR_TLS |
SMTP connection security level to use. | |
smtp_verify_host | - | string |
0 - NO (default) 1 - YES |
SSL verify host for SMTP. Optional if smtp_security is STARTTLS or SSL_OR_TLS. | |
smtp_verify_peer | - | string |
0 - NO (default) 1 - YES |
SSL verify peer for SMTP. Optional if smtp_security is STARTTLS or SSL_OR_TLS. | |
smtp_authentication | - | string |
0 - NONE (default) 1 - PASSWORD |
SMTP authentication method to use. | |
username | - | string |
Username. | ||
password | - | string |
Authentication password. | ||
content_type | - | string |
0 - TEXT 1 - HTML (default) |
Message format. | |
Used only by SMS media type | |||||
gsm_modem | x | string |
Serial device name of the GSM modem. | ||
Used only by script media type | |||||
script name | x | string |
Script name. | ||
parameters | - | Root element for script parameters. | |||
parameter | - | Individual script parameter. | |||
Used only by webhook media type | |||||
script | x | string |
Script. | ||
timeout | - | string |
1-60s (default: 30s) | Javascript script HTTP request timeout interval. | |
process_tags | - | string |
0 - NO (default) 1 - YES |
Whether to process returned tags. | |
show_event_menu | - | string |
0 - NO (default) 1 - YES |
If {EVENT.TAGS.*} were successfully resolved in event_menu_url and event_menu_name fields, this field indicates presence of entry in the event menu. | |
event_menu_url | - | string |
URL of the event menu entry. Supports {EVENT.TAGS.*} macro. | ||
event_menu_name | - | string |
Name of the event menu entry. Supports {EVENT.TAGS.*} macro. | ||
parameters | - | Root element for webhook media type parameters. | |||
parameter | - | Individual webhook media type parameter. | |||
name | x | string |
Webhook parameter name. | ||
value | - | string |
Webhook parameter value. |
1 For string values, only the string will be exported (e.g. "EMAIL") without the numbering used in this table. The numbers for range values (corresponding to the API values) in this table is used for ordering only.