6 Media types
Overzicht
Mediatypen worden geëxporteerd met alle gerelateerde objecten en objectrelaties.
If you have any more text to translate or need further assistance, feel free to ask!
Exporteren
Om mediatypen te exporteren, volgt u deze stappen:
- Ga naar Meldingen → Mediatypen.
- Markeer de selectievakjes van de mediatypen die u wilt exporteren.
- Klik op Exporteren onderaan de lijst.

Afhankelijk van het geselecteerde formaat worden mediatypen geëxporteerd naar een lokaal bestand met een standaardnaam:
- zabbix_export_mediatypes.yaml - bij YAML-export (standaardoptie voor export);
- zabbix_export_mediatypes.xml - bij XML-export;
- zabbix_export_mediatypes.json - bij JSON-export.
Importeren
Om mediatypen te importeren, volgt u deze stappen:
- Ga naar Meldingen → Mediatypen.
- Klik rechtsboven op Importeren.
- Selecteer het importbestand.
- Markeer de vereiste opties in de importregels.
- Klik op Importeren.

Importregels:
| Regel | Omschrijving |
|---|---|
| Bestaande bijwerken | Bestaande elementen worden bijgewerkt met gegevens uit het importbestand. Anders worden ze niet bijgewerkt. |
| Nieuwe maken | De import voegt nieuwe elementen toe met gegevens uit het importbestand. Anders worden ze niet toegevoegd. |
Een succes- of foutbericht van de import wordt weergegeven in de frontend.
Exporteerformaat
Exporteer naar YAML:
zabbix_export:
version: '6.4'
media_types:
-
name: Pushover
type: WEBHOOK
parameters:
- name: endpoint
value: 'https://api.pushover.net/1/messages.json'
- name: eventid
value: '{EVENT.ID}'
- name: event_nseverity
value: '{EVENT.NSEVERITY}'
- name: event_source
value: '{EVENT.SOURCE}'
- name: event_value
value: '{EVENT.VALUE}'
- name: expire
value: '1200'
- name: message
value: '{ALERT.MESSAGE}'
- name: priority_average
value: '0'
- name: priority_default
value: '0'
- name: priority_disaster
value: '0'
- name: priority_high
value: '0'
- name: priority_information
value: '0'
- name: priority_not_classified
value: '0'
- name: priority_warning
value: '0'
- name: retry
value: '60'
- name: title
value: '{ALERT.SUBJECT}'
- name: token
value: '<PUSHOVER TOKEN HERE>'
- name: triggerid
value: '{TRIGGER.ID}'
- name: url
value: '{$ZABBIX.URL}'
- name: url_title
value: Zabbix
- name: user
value: '{ALERT.SENDTO}'
max_sessions: '0'
script: |
try {
var params = JSON.parse(value),
request = new HttpRequest(),
data,
response,
severities = [
{name: 'not_classified', color: '#97AAB3'},
{name: 'information', color: '#7499FF'},
{name: 'warning', color: '#FFC859'},
{name: 'average', color: '#FFA059'},
{name: 'high', color: '#E97659'},
{name: 'disaster', color: '#E45959'},
{name: 'resolved', color: '#009900'},
{name: 'default', color: '#000000'}
],
priority;
if (typeof params.HTTPProxy === 'string' && params.HTTPProxy.trim() !== '') {
request.setProxy(params.HTTPProxy);
}
if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
throw 'Incorrect "event_source" parameter given: "' + params.event_source + '".\nMust be 0-3.';
}
if (params.event_value !== '0' && params.event_value !== '1'
&& (params.event_source === '0' || params.event_source === '3')) {
throw 'Incorrect "event_value" parameter given: ' + params.event_value + '\nMust be 0 or 1.';
}
if ([0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity)) === -1) {
params.event_nseverity = '7';
}
if (params.event_value === '0') {
params.event_nseverity = '6';
}
priority = params['priority_' + severities[params.event_nseverity].name] || params.priority_default;
if (isNaN(priority) || priority < -2 || priority > 2) {
throw '"priority" should be -2..2';
}
if (params.event_source === '0' && isNaN(params.triggerid)) {
throw 'field "triggerid" is not a number';
}
if (isNaN(params.eventid)) {
throw 'field "eventid" is not a number';
}
if (typeof params.message !== 'string' || params.message.trim() === '') {
throw 'field "message" cannot be empty';
}
data = {
token: params.token,
user: params.user,
title: params.title,
message: params.message,
url: (params.event_source === '0')
? params.url + '/tr_events.php?triggerid=' + params.triggerid + '&eventid=' + params.eventid
: params.url,
url_title: params.url_title,
priority: priority
};
if (priority == 2) {
if (isNaN(params.retry) || params.retry < 30) {
throw 'field "retry" should be a number with value of at least 30 if "priority" is set to 2';
}
if (isNaN(params.expire) || params.expire > 10800) {
throw 'field "expire" should be a number with value of at most 10800 if "priority" is set to 2';
}
data.retry = params.retry;
data.expire = params.expire;
}
data = JSON.stringify(data);
Zabbix.log(4, '[ Pushover Webhook ] Sending request: ' + params.endpoint + '\n' + data);
request.addHeader('Content-Type: application/json');
response = request.post(params.endpoint, data);
Zabbix.log(4, '[ Pushover Webhook ] Received response with status code ' + request.getStatus() + '\n' + response);
if (response !== null) {
try {
response = JSON.parse(response);
}
catch (error) {
Zabbix.log(4, '[ Pushover Webhook ] Failed to parse response received from Pushover');
response = null;
}
}
if (request.getStatus() != 200 || response === null || typeof response !== 'object' || response.status !== 1) {
if (response !== null && typeof response === 'object' && typeof response.errors === 'object'
&& typeof response.errors[0] === 'string') {
throw response.errors[0];
}
else {
throw 'Unknown error. Check debug log for more information.';
}
}
return 'OK';
}
catch (error) {
Zabbix.log(4, '[ Pushover Webhook ] Pushover notification failed: ' + error);
throw 'Pushover notification failed: ' + error;
}
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.
message_templates:
- event_source: TRIGGERS
operation_mode: PROBLEM
subject: 'Problem: {EVENT.NAME}'
message: |
Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}
- event_source: TRIGGERS
operation_mode: RECOVERY
subject: 'Resolved in {EVENT.DURATION}: {EVENT.NAME}'
message: |
Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Problem duration: {EVENT.DURATION}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}
- event_source: TRIGGERS
operation_mode: UPDATE
subject: 'Updated problem in {EVENT.AGE}: {EVENT.NAME}'
message: |
{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}
Current problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}.
- event_source: DISCOVERY
operation_mode: PROBLEM
subject: 'Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}'
message: |
Discovery rule: {DISCOVERY.RULE.NAME}
Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}
Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}
- event_source: AUTOREGISTRATION
operation_mode: PROBLEM
subject: 'Autoregistration: {HOST.HOST}'
message: |
Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}
Hier zijn de tags en eigenschappen die worden gebruikt in het Zabbix XML-exportformaat voor media-types:
-
media_types: Het root-element voor media-types.name: De naam van de media-type.type: Het type transport dat wordt gebruikt door de media-type (bijv. EMAIL, SMS, SCRIPT, WEBHOOK).status: Of de media-type is ingeschakeld (0 - ENABLED, 1 - DISABLED).max_sessions: Het maximum aantal gelijktijdig verwerkte waarschuwingen (voor SMS, 1 - onbeperkt, voor andere media-types, 0-100).attempts: Het maximale aantal pogingen om een waarschuwing te verzenden (standaard: 3).attempt_interval: Het interval tussen herhaalde pogingen (standaard: 10s).description: De beschrijving van de media-type.
-
message_templates: Het root-element voor berichtsjablonen van de media-type.event_source: De bron van het evenement (0 - TRIGGERS, 1 - DISCOVERY, 2 - AUTOREGISTRATION, 3 - INTERNAL, 4 - SERVICE).operation_mode: De bedrijfsmodus (0 - PROBLEM, 1 - RECOVERY, 2 - UPDATE).subject: Het onderwerp van het bericht.message: De inhoud van het bericht.
Voor specifieke media-types zijn er extra eigenschappen:
-
Voor het e-mailmedia-type:
smtp_server: SMTP-servernaam.smtp_port: Poort van de SMTP-server (standaard: 25).smtp_helo: SMTP helo.smtp_email: Het e-mailadres van waaruit meldingen worden verzonden.smtp_security: Het beveiligingsniveau voor de SMTP-verbinding (0 - NONE, 1 - STARTTLS, 2 - SSL_OR_TLS).smtp_verify_host: SSL controleer de host voor SMTP (0 - NO, 1 - YES).smtp_verify_peer: SSL controleer de peer voor SMTP (0 - NO, 1 - YES).smtp_authentication: De authenticatiemethode voor SMTP (0 - NONE, 1 - PASSWORD).username: De gebruikersnaam voor authenticatie.password: Het wachtwoord voor authenticatie.content_type: Het berichtformaat (0 - TEXT, 1 - HTML, standaard: HTML).
-
Voor het SMS-media-type:
gsm_modem: De naam van het seriële apparaat van de GSM-modem.
-
Voor het script-media-type:
script_name: De naam van het script.
-
Voor het webhook-media-type:
script: Het script.timeout: Time-outinterval voor HTTP-verzoeken in het JavaScript-script (standaard: 30s).process_tags: Of geretourneerde tags moeten worden verwerkt (0 - NO, 1 - YES).show_event_menu: Of er een invoer in het evenementmenu aanwezig is (0 - NO, 1 - YES).event_menu_url: URL van de invoer in het evenementmenu. Ondersteunt {EVENT.TAGS.*} macro's.event_menu_name: Naam van de invoer in het evenementmenu. Ondersteunt {EVENT.TAGS.*} macro's.
Daarnaast zijn er enkele tags zoals parameters die specifiek zijn voor bepaalde media-types en worden gebruikt om extra configuratiegegevens op te slaan, afhankelijk van het media-type.
Je kunt deze tags en eigenschappen gebruiken om media-types te exporteren en importeren in Zabbix.
The following additional elements are exported only for the Email media type.
| Element | Type | Description | |
|---|---|---|---|
| provider | string | Email provider. | |
| smtp_server | string | SMTP server. | |
| smtp_port | integer | SMTP server port to connect to. Default: 25. |
|
| smtp_helo | string | SMTP helo. | |
| smtp_email | string | Email address from which notifications will be sent. | |
| smtp_security | string | SMTP connection security level to use. Possible values:1 NONE (0, default), STARTTLS (1), SSL_OR_TLS (2). |
|
| smtp_verify_host | string | SSL verify host for SMTP. Possible values:1 NO (0, default), YES (1). |
|
| smtp_verify_peer | string | SSL verify peer for SMTP. Possible values:1 NO (0, default), YES (1). |
|
| smtp_authentication | string | SMTP authentication method to use. Possible values:1 NONE (0, default), PASSWORD (1). |
|
| username | string | Username. | |
| password | string | Authentication password. | |
| message_format | string | Message format. Possible values:1 TEXT (0), HTML (1, default). |
|
See also: Media type object (refer to the relevant property with a matching name).
SMS
The following additional elements are exported only for the SMS media type.
| Element | Type | Description | |
|---|---|---|---|
| gsm_modem | string | (required) Serial device name of the GSM modem. | |
See also: Media type object (refer to the relevant property with a matching name).
Script
The following additional elements are exported only for the Script media type.
| Element | Type | Description | |
|---|---|---|---|
| script name | string | (required) Script name. | |
| parameters | Root element for script parameters. | ||
| sortorder | string | (required) Order of the script parameters passed to the script as command-line arguments. | |
| value | string | Script parameter value. | |
See also: Media type object (refer to the relevant property with a matching name).
Webhook
The following additional elements are exported only for the Webhook media type.
| Element | Type | Description | |
|---|---|---|---|
| script | string | Script. | |
| timeout | string | Javascript script HTTP request timeout interval. Possible values:1 1-60s (default: 30s). |
|
| process_tags | string | Whether to process returned tags. Possible values:1 NO (0, default), YES (1). |
|
| show_event_menu | string | Indicates the presence of an entry in the event menu if the {EVENT.TAGS.*} macro was successfully resolved in event_menu_url and event_menu_name fields.Possible values:1 NO (0, default), YES (1). |
|
| 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 | string | (required) Webhook parameter name. | |
| value | string | Webhook parameter value. | |
See also: Media type object (refer to the relevant property with a matching name).
Voetnoten
1 Voor tekenreekswaarden wordt alleen de tekenreeks geëxporteerd (bijv. "EMAIL") zonder de nummering die in deze tabel wordt gebruikt. De nummers voor bereikwaarden (die overeenkomen met de API-waarden) in deze tabel worden alleen gebruikt voor ordening.