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

1 媒介类型

概述

媒介的定义确定了 Zabbix 发送通知和告警的渠道。

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

媒介类型的配置位于 告警媒介类型

某些媒介类型是在默认数据中完成了自定义的。您只需对其配置参数进行一些微调操作,即可正常运行。

自动 Gmail/Office365 媒体类型

Gmail 或 Office365 用户可能会受益于更简单的媒体类型配置。邮件媒体类型配置中的 电子邮件提供商 字段允许选择 Gmail 和 Office 365 的预配置选项。

选择 Gmail/Office365 相关选项时,只需提供发件人电子邮件地址/密码即可创建有效的媒体类型。

提供电子邮件地址/密码后,Zabbix 将能够自动使用实际/推荐值填充 Gmail/Office365 媒体类型的所有必需设置,即 SMTP 服务器SMTP 服务器端口SMTP helo连接安全。由于这种自动化,这些字段甚至不会显示,但是,可以在媒体类型列表中看到 SMTP 服务器和电子邮件详细信息(请参阅 详细信息 列)。

另请注意:

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

要测试配置的媒体类型是否有效,请单击最后一列中的 测试 链接(有关更多详细信息,请参阅 电子邮件Webhook脚本 的媒体类型测试)。

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

Configuring media type

Media types are configured in AlertsMedia 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.

通用参数

一些参数适用于所有媒体类型。

媒体类型 选项卡中,通用的一般属性包括:

参数 说明
名称 媒体类型的名称。
类型 选择媒体类型。
说明 输入说明。
已启用 选中复选框以启用媒体类型。

请参阅媒体类型的单独页面以了解特定于媒体的参数。

消息模板 选项卡允许为以下所有或部分事件类型设置默认通知消息:

  • 问题
  • 问题恢复
  • 问题更新
  • 服务
  • 服务恢复
  • 服务更新
  • 发现
  • 自动注册
  • 内部问题
  • 内部问题恢复

要自定义消息模板:

  1. 消息模板 选项卡中单击 :将打开一个 消息模板 弹出窗口。

  2. 选择所需的 消息类型 并编辑 主题消息 文本。

  3. 单击 添加 保存消息模板。

消息模板参数:

参数 说明
消息类型 应使用默认消息的事件类型。
每个事件类型只能定义一个默认消息。
主题 默认消息的主题。主题可能包含宏。限制为 255 个字符。
主题不适用于 SMS 媒体类型。
消息 默认消息。根据数据库类型,字符数会受到一定限制(有关详细信息,请参阅 发送消息
消息可能包含受支持的
在问题和问题更新消息中,支持表达式宏(例如,{?avg(/host/key,1h)})。

要更改现有消息模板:在 操作 列中单击 以编辑模板或单击 以删除消息模板。

可以为特定操作定义自定义消息模板(有关详细信息,请参阅 操作操作)。操作配置中定义的自定义消息将覆盖默认媒体类型消息模板。

定义消息模板对于所有媒体类型都是强制性的,包括不使用默认消息进行通知的 webhook 或自定义警报脚本。例如,如果未定义 Pushover webhook 的问题消息,则操作“将消息发送到 Pushover webhook”将无法发送问题通知。

Options 选项卡包含警报处理设置。可以为每种媒体类型配置相同的选项集。

所有媒体类型都并行处理。虽然每个媒体类型都可以配置最大并发会话数,但服务器上的警报器进程总数只能由 StartAlerters 参数 限制。一个触发器生成的警报将按顺序处理。因此,仅当多个通知由多个触发器生成时,才可以同时处理多个通知。

参数 说明
并发会话 选择媒体类型的并行警报器会话数:
一个 - 一个会话
无限制 - 无限数量的会话
自定义 - 选择自定义会话数
无限制/高值意味着更多的并行会话和更大的发送通知容量。在可能需要同时发送大量通知的大型环境中,应使用无限制/高值。
如果需要发送的通知多于并发会话数,则剩余的通知将排队;它们不会丢失。
尝试 尝试发送通知的尝试次数。最多可指定 100 次尝试;默认值为 '3'。如果指定 '1',Zabbix 将仅发送一次通知,并且如果发送失败,将不会重试。
尝试间隔 如果发送失败,尝试重新发送通知的频率,以秒为单位(0-3600)。如果指定 '0',Zabbix 将立即重试。
支持时间后缀,例如 5s、3m、1h。
Message templates

The Message templates tab allows to set default notification messages for all or some of the following event types:

  • Problem
  • Problem recovery
  • Problem update
  • Service
  • Service recovery
  • Service update
  • Discovery
  • Autoregistration
  • Internal problem
  • Internal problem recovery

To customize message templates:

  1. In the Message templates tab click on : a Message template popup window will open.
  2. Select required Message type and edit Subject and Message texts.
  3. Click on Add to save the message template.

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.

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. 在媒体选项卡中,单击

用户媒体属性:

参数 说明
类型 下拉列表包含已启用媒体类型的名称。
请注意,编辑已禁用媒体类型的媒体时,类型将显示为红色。
发送至 提供发送消息所需的联系信息。

对于电子邮件媒体类型,可以通过单击地址字段下方的 添加多个地址。在这种情况下,通知将发送到提供的所有电子邮件地址。还可以在电子邮件收件人的发送至字段中指定收件人姓名,格式为“收件人姓名 <[email protected]>”。请注意,如果提供了收件人姓名,则应将电子邮件地址括在尖括号 (<>) 中。支持名称中的 UTF-8 字符,不支持引号对和注释。例如:John Abercroft <[email protected]>[email protected] 都是有效格式。错误示例:John Doe [email protected]%%"Zabbix\@\<H(comment)Q\>" %%
活动时 您可以限制发送消息的时间,例如,仅设置工作日(1-5、09:00-18:00)。请注意,此限制基于用户 时区。如果用户时区发生变化并且与系统时区不同,则可能需要相应调整此限制,以免错过重要消息。
有关格式的说明,请参阅 时间段规范 页面。
支持用户宏。
使用严重性 勾选您想要接收通知的触发严重性的复选框。
请注意,如果您想接收非触发事件的通知,必须选中默认严重性(“未分类”)。
保存后,选定的触发严重性将以相应的严重性颜色显示,而未选定的触发严重性将变灰。
状态 用户媒体的状态。
已启用 - 正在使用中。
已禁用 - 未使用。