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

4 更新操作

4 Update operations

概述

Overview

当如下问题触发时,您就会收到通知:

Update operations allow you to be notified when problems are updated, i.e.:

  • 提交评论
  • 确认事件
  • 状态变化
  • (手动地)关闭操作
  • commented upon
  • acknowledged
  • severity changed
  • closed (manually)

在事件源触发器的动作里可以更新操作。

Update operations are available in actions with the event source as Triggers.

更新操作可以包含信息和远程命令。更新操作不支持升级-所以的操作都被分配到某一个步骤中。

Both messages and remote commands are supported in update operations. Update operations do not support escalating - all operations are assigned to a single step.

配置一个更新操作

Configuring an update operation

要做一个更新操作:

To configure an update operation:

  • 在action中进入 Update operations 标签页 configuration
  • 在操作块中点击 New
  • 编辑操作明细并点击 Add
  • Go to the Update operations tab in action configuration
  • Click on New in the Operations block
  • Edit the operation details and click on Add

一些操作即被添加。

Several operations can be added.

更新操作属性:

Update operation attributes:

Parameter Description
Default subject 更新通知的默认消息主题. 消息主题可能包含宏 .
Default message 更新通知的默认消息. 消息可能包含宏 .
Operations 展示更新操作的细节.
配置一个更新操作,点击 New.
Operation details 用于配置更新操作的详细内容.
Operation type 三个操作:
Send message - 当事件更新(例如,acknowledged确认操作)时,发送更新消息给指定的用户,
Remote command - 当事件更新(例如,acknowledged确认操作)时,执行远程命令,
Notify all involved - 发送通知给所有收到问题通知或者事件变化的用户.执行操作的人不必收到他们自己更新操作的通知信息.
如果在多个操作类型中,状态未变化的默认主题或消息是通知给同一个接收人的,重复的通知将不会被发送.
Operation type: 发送消息
Send to user groups 点击 Add 选择发送更新消息的用户分组.
为了发送通知,用户组必须具有相应主机的读 权限
Send to users 点击 Add 选择接收更新消息的用户.
为了收到通知,用户组至少有相应主机的读 权限.
Send only to 发送更新消息给所有类型的媒介或者其中之一.
Default message 如果使用该配置项,将使用默认消息(详见上述提及).
Subject 自定义消息的主题.主题可能包含宏.
Message 自定义消息. 消息可能包含宏.
Operation type: 远程命令
Target list 选择执行命令的目标:
Current host - 命令在配置了触发器的发生问题主机上执行.如果触发器上有多个主机,这个选项不生效.
Host - 选择执行命令的主机.
Host group - 选择执行命令的主机组. 选定一个主机群组意味着选择所有内置的主机组.因此,远程命令将也在内置主机组执行.
即使主机组(例如,几个主机组或单独一个主机)匹配了多次,但是主机只执行一次命令.
如果命令在Zabbix server上执行,那么目的主机列表也就没有意义. 本例中选择更多的目的主机可以在主机上执行多次.
注意,目标主机依赖于Host group中全局的设置配置.
Type 选择命令类型:
IPMI - 执行 IPMI 命令
Custom script - 执行一个命令集
SSH - 执行SSH命令
Telnet - 执行Telnet命令
Global script - 执行在Administration→Scripts中定义的全局脚本.
Execute on 执行自定义脚本:
Zabbix agent - 脚本在Zabbix agent主机上执行
Zabbix server (proxy) - 脚本在Zabbix server or proxy主机上执行 - 依赖于主机是否被server或proxy监控
Zabbix server - 脚本仅在Zabbix server上执行
在Zabbix agent上执行, 必须允许从服务端可以执行远程命令 configured.
当选择Type为'Custom script' 时,这个字段可用.
Commands 输入命令(或命令集).
支持基于触发器表达式的宏解析. 例如,主机宏将解析为触发器表达式使用的宏变量.
Operation type: notify all involved
Default media type 用户更新问题但没有收到通知,接下来更新的通知将通过Email, Jabber or SMS接收通知.
从Zabbix 3.4.2开始,支持该配置项.
Default message 如果选择使用,默认的消息将被使用.
Subject 自定义主题. 主体可能包含宏.
Message 自定义消息. 消息可能包含宏.
Parameter Description
Default subject Default message subject for update notifications. The subject may contain macros.
Default message Default message for update notifications. The message may contain macros.
Operations Update operation details are displayed.
To configure a new update operation, click on New.
Operation details This block is used to configure the details of an update operation.
Operation type Three operation types are available for update operations:
Send message - send update message to specified user when event is updated, for example, acknowledged
Remote command - execute a remote command when event is updated, for example, acknowledged
Notify all involved - send notification message to all users who received notification about the problem appearing and/or have updated the problem event. The person who updates does not receive notification about their own update.
If the same recipient with unchanged default subject/message is defined in several operation types, duplicate notifications are not sent.
Operation type: send message
Send to user groups Click on Add to select user groups to send the update message to.
The user group must have at least "read" permissions to the host in order to be notified.
Send to users Click on Add to select users to send the update message to.
The user must have at least "read" permissions to the host in order to be notified.
Send only to Send update message to all defined media types or a selected one only.
Default message If selected, the default message will be used (see above).
Subject Subject of the custom message. The subject may contain macros.
Message The custom message. The message may contain macros.
Operation type: remote command
Target list Select targets to execute the command on:
Current host - command is executed on the host of the trigger that caused the problem event. This option will not work if there are multiple hosts in the trigger.
Host - select host(s) to execute the command on.
Host group - select host group(s) to execute the command on. Specifying a parent host group implicitly selects all nested host groups. Thus the remote command will also be executed on hosts from nested groups.
A command on a host is executed only once, even if the host matches more than once (e.g. from several host groups; individually and from a host group).
The target list is meaningless if the command is executed on Zabbix server. Selecting more targets in this case only results in the command being executed on the server more times.
Note that for global scripts, the target selection also depends on the Host group setting in global script configuration.
Type Select the command type:
IPMI - execute an IPMI command
Custom script - execute a custom set of commands
SSH - execute an SSH command
Telnet - execute a Telnet command
Global script - execute one of the global scripts defined in Administration→Scripts.
Execute on Execute a custom script on:
Zabbix agent - the script will be executed by Zabbix agent on the host
Zabbix server (proxy) - the script will be executed by Zabbix server or proxy - depending on whether the host is monitored by server or proxy
Zabbix server - the script will be executed by Zabbix server only
To execute scripts on the agent, it must be configured to allow remote commands from the server.
This field is available if 'Custom script' is selected as Type.
Commands Enter the command(s).
Supported macros will be resolved based on the trigger expression that caused the event. For example, host macros will resolve to the hosts of the trigger expression (and not of the target list).
Operation type: notify all involved
Default media type Users who update a problem but have not received notifications about the problem appearing will receive notifications about further updates on the selected default media type - Email, Jabber or SMS.
This field is available since Zabbix 3.4.2.
Default message If selected, the default message will be used (see above).
Subject Subject of the custom message. The subject may contain macros.
Message The custom message. The message may contain macros.