6 Media types
Overview
Media types are exported with all related objects and object relations.
Exporting
To export media types, do the following:
Go to: Administration → Media types
Mark the checkboxes of the media types to export
Click on Export below the list
Depending on the selected format, media types are exported to a local file with a default name:
zabbix_export_mediatypes.yaml - in YAML export (default option for export)
zabbix_export_mediatypes.xml - in XML export
zabbix_export_mediatypes.json - in JSON export
Importing
To import media types, do the following:
Go to: Administration → Media types
Click on Import to the right
Select the import file
Mark the required options in import rules
Click on Import
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. |
Export format
Export to YAML:
---
zabbix_export:
version: "5.2"
date: "2020-08-06T08:19:30Z"
media_types:
- name: Pushover
type: WEBHOOK
parameters:
7:
name: eventid
value: '{EVENT.ID}'
2:
name: message
value: '{ALERT.MESSAGE}'
6:
name: priority
value: "0"
3:
name: title
value: '{ALERT.SUBJECT}'
0:
name: token
value: <PUSHOVER TOKEN HERE>
8:
name: triggerid
value: '{TRIGGER.ID}'
4:
name: url
value: '{$ZABBIX.URL}'
5:
name: url_title
value: Zabbix
1:
name: user
value: '{ALERT.SENDTO}'
max_sessions: "0"
script: "try {\n//\tZabbix.Log(127, 'Pushover webhook script value='+value);\n\n\tparams
= JSON.parse(value),\n\treq = new CurlHttpRequest(),\n\tfields = {};\n\n\treq.AddHeader('Content-Type:
application/json');\n\n\tfields.token= params.token;\n\tfields.user = params.user;\n\n\n
\ /*\n If a device name is not specified for a user, or the specified
device name is no longer enabled/valid,\n notifications will be sent to
all active devices for that user to avoid losing messages.\n Messages
may be addressed to multiple specific devices by joining them with a comma (such
as device=iphone,nexus5).\n fields.device = params.device;\n */\n\tfields.title
= params.title;\n\tfields.message = params.message;\n fields.url =
params.url+\"/tr_events.php?triggerid=\"+params.triggerid+\"&eventid=\"+params.eventid;\n
\ fields.url_title = params.url_title;\n fields.priority = params.priority;\n\tvar
resp = req.Post('https://api.pushover.net/1/messages.json',\n\t\tJSON.stringify(fields)\n\t);\n\n\tif
(req.Status() != 200) {\n\t\tthrow JSON.parse(resp).errors[0];\n\t}\n\n\tresp
= JSON.parse(resp);\n return \"OK\";\n\n} catch (error) {\n\tZabbix.Log(127,
'Pushover notification failed : '+error);\n throw 'Pushover notification
failed : '+error;\n}"
description: |-
Please refer to setup guide here: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/pushover
Set token parameter with to your Pushover application key.
When assigning Pushover media to the Zabbix user - add user key into send to field.
...
Element tags
Element tag values are explained in the table below.
Element | Element property | Required | Type | Range1 | Description |
---|---|---|---|---|---|
media_types | - | Root element for media_types. | |||
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. | |||
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. | |||
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. | |||
name | x | string | Webhook parameter name. | ||
value | - | string | Webhook parameter value. |
Footnotes
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.