Sidebar

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

3 恢复操作

3 Recovery operations

概述

Overview

恢复操作允许在问题解决时通知您。

Recovery operations allow you to be notified when problems are resolved.

恢复操作支持消息和远程命令。恢复操作不支持通知升级 - 因为所有操作都分配到一个单独的步骤。

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

使用场景

Use cases

恢复操作的一些用例如下:

Some use cases for recovery operations are as follows:

  1. 通知所有通知有关问题的用户
   * 选择“发送恢复消息”作为操作类型
       - 恢复时有多个操作:发送通知并执行远程命令
          * 添加发送消息和执行命令的操作类型
       - 在外部帮助台/票务系统中打开机票,并在问题解决时将其关闭
          * 创建一个与帮助台系统通信的外部脚本
          * 创建一个操作,该操作具有执行此脚本的操作,从而打开一张票据
          * 恢复操作,使用其他参数执行此脚本并关闭故障单
          * 使用{EVENT.ID}宏来引用原始问题
  1. Notify all users that were notified on the problem
   * Select 'Send recovery message' as operation type
       - Have multiple operations upon recovery: send a notification and execute a remote command
          * Add operation types for sending a message and executing a command
       - Open a ticket in external helpdesk/ticketing system and close it when the problem is resolved
          * Create an external script that communicates with the helpdesk system
          * Create an action having operation that executes this script and thus opens a ticket
          * Have a recovery operation that executes this script with other parameters and closes the ticket
          * Use the {EVENT.ID} macro to reference the original problem

配置恢复操作

Configuring a recovery operation

配置恢复操作:

To configure a recovery operation:

  • 进入action配置中的恢复操作标签
  • 点击操作块中的New
  • 编辑操作详情并且点击 Add
  • Go to the Recovery 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.

恢复操作属性:

Recovery operation attributes:

All mandatory input fields are marked with a red asterisk.

参数
Default subject 恢复通知的默认消息主题. 主题可能包含 .
Default message 恢复通知的默认消息. 消息可能包含 .
Operations 恢复操作详细信息显示.
要配置新的恢复操作,请单击 New.
Operation details 此块用于配置恢复操作的详细信息.
Operation type 有三种操作类型可用于恢复事件:
Send recovery message - 所有在问题事件通知的用户发送恢复消息
Send message - 发送恢复信息给指定的用户
Remote command - 执行远程命令
操作类型:发送恢复信息
Default message 如果选择,将使用默认消息(见上文).
Subject 自定义消息的主题. 主题可能包含宏.
Message 自定义消息. 消息可能包含宏.
操作类型:发信息
发送到用户组 点击 *A d* 选择要发送恢复消息的用户组.
用户组必须至少具有“读取”权限向主机通知.
Send to users 点击 Add 选择要发送恢复消息的用户组.
用户组必须至少具有“读取”" 权限 向主机通知.
Send only to 将恢复消息发送到所有定义的媒体类型或仅选定的媒体类型.
Default message 如果选择, 将使用默认消息(见上文).
Subject 自定义消息的主题. 主题可能包含宏.
Message 自定义消息. 消息可能包含宏.
Operation type: 远程命令
Target list 选择当前主机,其他主机或主机组作为目标执行命令.
Type 选择命令类型:
IPMI - 执行IPMI命令
Custom script - 执行一组自定义的命令. 您可以选择在Zabbix代理或Zabbix服务器上执行该命令。
SSH - 执行SSH命令
Telnet - 执行Telnet命令
Global script -执行管理 - >脚本其中定义的全局脚本之一.
Execute on 在Zabbix代理或Zabbix服务器上执行命令.
Commands 输入命令.
Parameter Description
Default subject Default message subject for recovery notifications. The subject may contain macros.
Default message Default message for recovery notifications. The message may contain macros.
Operations Recovery operation details are displayed.
To configure a new recovery operation, click on New.
Operation details This block is used to configure the details of a recovery operation.
Operation type Three operation types are available for recovery events:
Send message - send recovery message to specified user
Remote command - execute a remote command
Notify all involved - send recovery message to all users who were notified on the problem event
Note that 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 recovery 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 recovery message to.
The user must have at least "read" permissions to the host in order to be notified.
Send only to Send recovery 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 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.