媒介的定义确定了 Zabbix 发送通知和告警的渠道。
您可以配置多种媒介类型:
媒介类型的配置位于 告警 → 媒介类型。
某些媒介类型是在默认数据中完成了自定义的。您只需对其配置参数进行一些微调操作,即可正常运行。
Gmail 或 Office365 用户可能会受益于更简单的媒体类型配置。邮件媒体类型配置中的 电子邮件提供商 字段允许选择 Gmail 和 Office 365 的预配置选项。
选择 Gmail/Office365 相关选项时,只需提供发件人电子邮件地址/密码即可创建有效的媒体类型。
提供电子邮件地址/密码后,Zabbix 将能够自动使用实际/推荐值填充 Gmail/Office365 媒体类型的所有必需设置,即 SMTP 服务器、SMTP 服务器端口、SMTP helo 和 连接安全。由于这种自动化,这些字段甚至不会显示,但是,可以在媒体类型列表中看到 SMTP 服务器和电子邮件详细信息(请参阅 详细信息 列)。
另请注意:
example-com.mail.protection.outlook.com
中的“example.com”替换为实际值)。要测试配置的媒体类型是否有效,请单击最后一列中的 测试 链接(有关更多详细信息,请参阅 电子邮件、Webhook 或 脚本 的媒体类型测试)。
要创建新的媒体类型,请单击 建媒体类型 按钮。将打开媒体类型配置表单。
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:
Media types are configured in Alerts → Media types.
Some media types come pre-defined in the default dataset. You just need to finetune their parameters to get them working.
To test if a configured media type works, click on the Test link in the last column (see media type testing for Email, Webhook, or Script for more details).
To create a new media type, click on the Create media type button. A media type configuration form is opened.
The Message templates tab allows to set default notification messages for all or some of the following event types:
To customize message templates:
Message template parameters:
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)} ). |
To make changes to an existing message template: in the Actions column click on to edit the template or click on
to delete the message template.
It is possible to define a custom message template for a specific action (see action operations for details). Custom messages defined in the action configuration will override default media type message template.
Defining message templates is mandatory for all media types, including webhooks or custom alert scripts that do not use default messages for notifications. For example, an action "Send message to Pushover webhook" will fail to send problem notifications, if the Problem message for the Pushover webhook is not defined.
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-5、09:00-18:00)。请注意,此限制基于用户 时区。如果用户时区发生变化并且与系统时区不同,则可能需要相应调整此限制,以免错过重要消息。 有关格式的说明,请参阅 时间段规范 页面。 支持用户宏。 |
使用严重性 | 勾选您想要接收通知的触发严重性的复选框。 请注意,如果您想接收非触发事件的通知,必须选中默认严重性(“未分类”)。 保存后,选定的触发严重性将以相应的严重性颜色显示,而未选定的触发严重性将变灰。 |
状态 | 用户媒体的状态。 已启用 - 正在使用中。 已禁用 - 未使用。 |