这是原厂英文文档的翻译页面. 欢迎帮助我们 完善文档.

1 媒介类型

概述

媒介是用于从 Zabbix 发送通知和警报的传输通道。

您可以配置多种媒介类型:

媒介类型在 警报媒介类型 中进行配置。

某些媒介类型在默认数据集中已经预定义。您只需微调其参数即可get其正常工作。

自动化 Gmail/Office365 媒介类型

Gmail 或 Office365 用户可以从更简便的媒介类型配置中受益。在邮件媒介类型配置中,电子邮件提供商 字段允许为 Gmail 和 Office 365 选择预配置选项。

当选择 Gmail/Office365 相关选项时,只需提供发件人电子邮件地址和密码即可create一个可用的媒介类型。

一旦提供了电子邮件地址和密码,Zabbix 将能够自动填写 Gmail/Office365 媒介类型所需的所有设置,包括实际或推荐值,例如 SMTP 服务器SMTP 服务器端口SMTP helo连接安全性。由于这种自动化机制,这些字段甚至不会显示出来。不过,您可以在媒介类型列表中查看 SMTP 服务器和电子邮件详细信息(参见 详细信息 列)。

还需注意:

  • 中继选项不需要密码。
  • 对于 Office365 中继,所提供的电子邮件地址的域名将用于动态填充 SMTP 服务器(即,将 example-com.mail.protection.outlook.com 中的 "example.com" 替换为真实值)。

要测试配置的媒介类型是否正常工作,请点击最后一列的 测试 链接(有关媒介类型测试的更多信息,请参见 媒介类型测试媒介类型测试媒介类型测试)。

要create新的媒介类型,请点击 创建媒介类型 按钮。将打开媒介类型配置表单。

Media type testing

To test if a configured media type works, click on Test in the media type list.

The testing request will be sent to Zabbix server. Zabbix server will attempt to send an alert using the specified media type and will return the result to frontend. The frontend will wait for the server to return the results. Media type testing has a 65-second timeout by default (configurable in Administration > General > Timeouts).

See also testing details for:

Configuration

To create a media type in Zabbix frontend:

  • Go to: Alerts > Media types
  • Click on Create media type
  • Enter parameters of the media type in the form

Some parameters are common for all delivery methods.

Parameter Description
Name Name of the media type.
Type Select the delivery method for the media type.
Description Enter a description for the media type.
Enabled Mark the checkbox to enable the media type.

For method-specific parameters, see email, SMS, custom alertscript, or webhook pages.

Message templates

The Message templates tab contains default messages per event type (problem, problem recovery, discovery, etc).

Click on Add to define a default message (or Edit to update an existing message):

Parameter Description
Message type Type of an event for which the default message should be used.
Only one default message can be defined for each event type.
Subject Subject of the default message. The subject may contain macros. It is limited to 255 characters.
Subject is not available for SMS media type.
Message The default message. It is limited to certain amount of characters depending on the database type (see Sending messages for more information).
The message may contain supported macros.
In problem and problem update messages, expression macros are supported (for example, {?avg(/host/key,1h)}).

Note that default messages are overridden by custom messages, if defined in action operations.

Defining message templates is mandatory for all delivery methods, including webhooks or custom alert scripts that do not use default messages for notifications. For example, the action "Send message to Pushover webhook" will fail to send problem notifications, if the problem message for the Pushover webhook is not defined.

Options

The Options tab contains alert processing settings. The same set of options is configurable for each media type.

All media types are processed in parallel. While the maximum number of concurrent sessions is configurable per media type, the total number of alerter processes on the server can only be limited by the StartAlerters parameter. Alerts generated by one trigger are processed sequentially. So multiple notifications may be processed simultaneously only if they are generated by multiple triggers.

Parameter Description
Concurrent sessions Select the number of parallel alerter sessions for the media type:
One - one session
Unlimited - unlimited number of sessions
Custom - select a custom number of sessions
Unlimited/high values mean more parallel sessions and increased capacity for sending notifications. Unlimited/high values should be used in large environments where lots of notifications may need to be sent simultaneously.
If more notifications need to be sent than there are concurrent sessions, the remaining notifications will be queued; they will not be lost.
Attempts Number of attempts for trying to send a notification. Up to 100 attempts can be specified; the default value is '3'. If '1' is specified, Zabbix will send the notification only once and will not retry if the sending fails.
Attempt interval Frequency of trying to resend a notification in case the sending failed, in seconds (0-3600). If '0' is specified, Zabbix will retry immediately.
Time suffixes are supported, e.g., 5s, 3m, 1h.

用户媒介

要接收特定媒介类型的通知,必须在用户资料中为此媒介类型定义一个媒介(电子邮件地址/电话号码/Webhook 用户 ID 等)。例如,如果用户资料中未定义 Webhook "X" 媒介,则使用 Webhook "X" 向用户 "Admin" 发送消息的操作将始终失败。

要定义用户媒介:

  1. 进入您的用户资料,或者进入 用户 → 用户,然后打开用户属性表单。
  2. 在媒介页签中,点击

用户媒介属性:

参数 描述
Type 下拉列表包含已启用的媒介类型名称。
请注意,当编辑一个已禁用媒介类型的媒介时,该类型将以红色显示。
Send to 提供必要的联系信息以发送消息。

对于电子邮件媒介类型,可以通过点击地址字段下方的 添加多个地址。在这种情况下,通知将发送到所有提供的电子邮件地址。也可以在电子邮件收件人的 发送至 字段中以 '收件人名称 <[email protected]>' 的格式指定收件人名称。请注意,如果提供了收件人名称,则电子邮件地址必须用尖括号(<>)括起来。支持名称中的 UTF-8 字符,不支持引号对和注释。例如:John Abercroft <[email protected]>[email protected] 都是有效的格式。错误示例:John Doe [email protected], %%"Zabbix\@\<H(comment)Q\>" %%
When active 您可以限制消息发送的时间,例如,仅在工作日(1-5,09:00-18:00)。请注意,此限制基于用户的 time zone。如果用户时区更改且与系统时区不同,则可能需要相应调整此限制,以免错过重要消息。
格式描述请参见 Time period specification 页面。
支持用户宏。
Use if severity 勾选您希望接收通知的触发器严重性复选框。
注意:如果您希望接收非触发器 events 的通知,则必须勾选默认严重性(“未分类”)。
保存后,所选触发器严重性将以相应的严重性颜色显示,未选中的将以灰色显示。
Status 用户媒介的状态。
已启用 - 正在使用。
已禁用 - 未使用。

Automated Gmail/Office365 media types

Gmail or Office365 users may benefit from easier media type configuration. The Email provider field in the mail media type configuration allows to select pre-configured options for Gmail and Office 365.

When selecting the Gmail/Office365 related options, it is only required to supply the sender email address/password to create a working media type.

As soon as the email address/password is supplied, Zabbix will be able to automatically fill all required settings for Gmail/Office365 media types with the actual/recommended values, i.e., SMTP server, SMTP server port, SMTP helo, and Connection security. Because of this automation, these fields are not even shown, however, it is possible to see the SMTP server and email details in the media type list (see the Details column).

Note also that:

  • The password is not required for the relay options.
  • For Office365 relay, the domain name of the provided email address will be used to dynamically fill the SMTP server (i.e., replace "example.com" in example-com.mail.protection.outlook.com with the real value).