2022 Zabbix中国峰会
2022 Zabbix中国峰会

1 E-mail

1 E-mail

概述

Overview

要将电子邮件配置为邮件的传递通道,您需要将电子邮件配置为媒介类型,并为用户分配具体的邮件地址。

To configure e-mail as the delivery channel for messages, you need to configure e-mail as the media type and assign specific addresses to users.

配置

Configuration

配置电子邮件为媒介类型:

To configure e-mail as the media type:

  • 管理 - >媒体类型中设置
  • 点击创建媒介类型 (或者点击预定义媒介类型的列表中的E-mail)
  • Go to Administration → Media types
  • Click on Create media type (or click on E-mail in the list of pre-defined media types).

媒介类型属性:

The Media type tab contains general media type attributes:

All mandatory input fields are marked with a red asterisk.

参数 说
Name 媒介类型的名称.
Type 选择 Email.
SMTP server 设置SMTP服务器来处理传出的消息.
SMTP server port 设置SMTP服务器端口来处理传出的消息.
Zabbix 3.0版本之后支持此选项.
SMTP helo 设置正确的SMTP helo值,通常是域名.
SMTP email 此处输入的地址将被用作发送消息的** From 地址.  选中该复选框以验证SMTP服务器的在Zabbix-HQ <[email protected]>中添加发件人显示名称(如“Zabbix-HQ”) Zabbix 2.2版本之后,支持实际的电子邮件地址.  “SSLCALocation”服务器配置指令的值应该放在[与RFC 5322允许的相比,Zabbix电子邮件中的显示名称有一些限制,如示例所示:  设置 cURL选项 [CURLOPT_SSL_VER有效的例子:  Zabb[email protected]* (只有电子邮件地址,不需要使用尖括号)
Zabbix HQ <[email protected]> (尖括号中是显示名称和电子邮件地址)
∑Ω-monitoring <[email protected]> (UTF-8 characters in display name)\\无效示例:
Zabbix HQ [email protected] (显示名称存在,但电子邮件地址没有尖括号)
"Zabbix\@\<H(comment)Q\>" <[email protected]> (虽然RFC 5322有效,但Zabbix电子邮件中不支持引用的对和注释) | |Connection security |选择连接安全级别:
None** - 不要使用 CURLOPT_USE_SSL选项
STARTTLS - 使用 有CURLUSESSL_ALL值的CURLOPT_USE_SSL 选项
SSL/TLS - 是否使用CURLOPT_USE_SSL是可选的
支持此选项 // Zabbix 3.0之后可以. | |SSL verify peer//
SL证书.
URLOPT_CAPATH](http://curl.haxx.se/libcurl/c/CURLOPT_CAPATH.html) 中以进行证书验证
FYPEER](http://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html).
x 3.0*之后支持此选项.
SSL verify host 标记该复选框以验证SMTP服务器证书的公用名称字段或主题备用名称字段是否匹配  选择认证级别:
设置cURL选项 CURLOPT_SSL_VERIFYHOSTN// Zabbix 3.0之后支持此选项. | |Authentication// Norm
认证中使用的用户名.
ne** - 没有设置cURL选项  设置 [CURLOl password** - CURLOPT_LOGIN_OPTIONS在"AUTH=PLAIN"中设置  // Zabbix// Zabbix 3.0之后. 支持此选项 | |Username//
认证中使用的密码.
T_USERNAME](http://curl.haxx.se/libcurl/c/CURLOPT_USERNAME.html)的值.  设置 [CURLOPT_.0之后. 支持此选项 | |Password// // Zabbix 3.0之后*.
标记该复选框以启用媒体类型.ASSWORD](http://curl.haxx.se/libcurl/c/CURLOPT_PASSWORD.html)的值.
支持此选项 | |*Enabled//
Parameter Description
Name Name of the media type.
Type Select Email as the type.
SMTP server Set an SMTP server to handle outgoing messages.
SMTP server port Set the SMTP server port to handle outgoing messages.
This option is supported starting with Zabbix 3.0.
SMTP helo Set a correct SMTP helo value, normally a domain name.
SMTP email The address entered here will be used as the From address for the messages sent.
Adding a sender display name (like "Zabbix-HQ" in Zabbix-HQ <[email protected]> in the screenshot above) with the actual e-mail address is supported since Zabbix 2.2 version.
There are some restrictions on display names in Zabbix emails in comparison to what is allowed by RFC 5322, as illustrated by examples:
Valid examples:
[email protected] (only email address, no need to use angle brackets)
Zabbix HQ <[email protected]> (display name and email address in angle brackets)
∑Ω-monitoring <[email protected]> (UTF-8 characters in display name)
Invalid examples:
Zabbix HQ [email protected] (display name present but no angle brackets around email address)
"Zabbix\@\<H(comment)Q\>" <[email protected]> (although valid by RFC 5322, quoted pairs and comments are not supported in Zabbix emails)
Connection security Select the level of connection security:
None - do not use the CURLOPT_USE_SSL option
STARTTLS - use the CURLOPT_USE_SSL option with CURLUSESSL_ALL value
SSL/TLS - use of CURLOPT_USE_SSL is optional
This option is supported starting with Zabbix 3.0.
SSL verify peer Mark the checkbox to verify the SSL certificate of the SMTP server.
The value of "SSLCALocation" server configuration directive should be put into CURLOPT_CAPATH for certificate validation.
This sets cURL option CURLOPT_SSL_VERIFYPEER.
This option is supported starting with Zabbix 3.0.
SSL verify host Mark the checkbox to verify that the Common Name field or the Subject Alternate Name field of the SMTP server certificate matches.
This sets cURL option CURLOPT_SSL_VERIFYHOST.
This option is supported starting with Zabbix 3.0.
Authentication Select the level of authentication:
None - no cURL options are set
(since 3.4.2) Username and password - implies "AUTH=*" leaving the choice of authentication mechanism to cURL
(until 3.4.2) Normal password - CURLOPT_LOGIN_OPTIONS is set to "AUTH=PLAIN"
This option is supported starting with Zabbix 3.0.
Username User name to use in authentication.
This sets the value of CURLOPT_USERNAME.
This option is supported starting with Zabbix 3.0.
Password Password to use in authentication.
This sets the value of CURLOPT_PASSWORD.
This option is supported starting with Zabbix 3.0.
Enabled Mark the checkbox to enable the media type.

要使SMTP验证选项可用,Zabbix服务器应使用cURL 7.20.0或更高版本的编译选项 - with-libcurl 进行编译。

To make SMTP authentication options available, Zabbix server should be compiled with the --with-libcurl compilation option with cURL 7.20.0 or higher.

Options标签页

Options

在e-mail媒介类型的Options标签页 配置 包含了告警进程设置。同样,其他媒介也有同样的可配置的选项。

The Options tab in the e-mail media type configuration contains alert processing settings. The same set of options are configurable for other media types, too.

所有的媒介类型是并行处理的。每个媒介类型的当前最大会话数量是可配置的,且服务端告警进程数量通过参数StartAlerters限制。一个触发器产生的警报是顺序执行的。

All media types are processed in parallel. The maximum number of concurrent sessions is configurable per media type, but the total number of alerter processes on server can only be limited by the StartAlerters parameter. Alerts generated by one trigger are processed sequentially.

参数 说
并行会话 选择并 告警会话媒介类型的数量:
One - 单会话
Unlimited - 不限制会话数量
Custom - 自定义会话数量
Unlimited/high取值意味在发送通知时会产生更多并行会话且会话数量不断增加. Unlimited/high取值应该应用在同时发送大量通知的场景的下使用.
尝试次数 发送通 (异常或失败时)尝试的次数,该值最大可设置为10,默认情况下为3. 如果设置为1,那么通知只会发送一次,即使失败也不会重发.
重试次数 在发送 败的情况下重试发送的频度, 默认单位为秒。如果设置为0,那么发送失败时会立即重发.
设置也支持自定义时间单位,例如,5s,1m.
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.
Attempts Number of attempts for trying to send a notification. Up to 10 attempts can be specified; default value is '3'. If '1' is specified Zabbix will send the notification only once and will not retry if the sending fails.
Retry interval Frequency of trying to resend a notification in case the sending failed, in seconds (0-60). If '0' is specified, Zabbix will retry immediately.
Time suffixes are supported, e.g. 5s, 1m.

用户媒介

User media

要为用户分配一个邮件地址:

To assign a specific address to the user:

  • 管理 - >用户 中进行设置
  • 打开用户属性窗体
  • 在媒介选项卡中,单击 Add
  • Go to Administration → Users
  • Open the user properties form
  • In Media tab, click on Add

用户媒介属性:

User media attributes:

参数 说
Type 选择Email为媒介类型.
Send to 指定发送消息的电子邮件地址. 添加收件人显示名称( Some User <[email protected]> 如上截图中的“Some User” )以及Zabbix 2.2 版本之后支持的实际电子邮件地址.
请参阅媒体类型属性 SMTP电子邮件描述中显示名称和电子邮件地址的示例和限制.
When active 您可以限制邮件发送的时间,例如仅限工作日(1-5,09:00-18:00).格式的描述请参见 时间段格式页面.
Use if severity 标记您要接收通知的触发严重性的复选框.
Note 对于非触发事件,使用默认严重性('未分类'),因此如果要接收非触发事件的通知,请将其保留.
Status 用户媒介的状态
Enabled - 正在使用.
Disabled - 没有被使用.
Parameter Description
Type Select Email as the type.
Send to Specify e-mail addresses to send the messages to.
To add more than one address click on Add below the address field. If multiple e-mail addresses are specified, one e-mail will be sent to all the specified recipients.
You may add the recipient display name (like "Recipient name" in Recipient name <[email protected]> in the screenshot above) with the actual e-mail address. See examples and restrictions on display name and email address in media type attribute SMTP email description.
When active You can limit the time when messages are sent, for example, the working days only (1-5,09:00-18:00).
See the Time period specification page for description of the format. User macros are supported.
Use if severity Mark the checkboxes of trigger severities that you want to receive notifications for.
Note that the default severity ('Not classified') must be checked if you want to receive notifications for non-trigger events.
After saving, the selected trigger severities will be displayed in the corresponding severity colours while unselected ones will be greyed out.
Status Status of the user media.
Enabled - is in use.
Disabled - is not being used.