基于触发器的事件关联允许关联一个触发器产生的不同问题。
通常,在Zabbix中正常事件会关闭一个触发器生成的所有问题事件,但在某些情况下需要更加细致的方法。例如,当监控日志文件时,在日志文件中想要发现某些问题,并将它们单独关闭,而不是一起关闭。
当触发器配置页面的多重问题时间生成选项为启用的情况下,通常适用于日志监控、被动采集(trap)处理等。
换言之,相同的触发器可以创建由事件标签标识的的不同事件。因此,可以一个一个单独地标识问题事件,并基于事件标签地标识单独关闭。
在日志监控中,可能会遇到下面类似地输出:
事件关联地想法是将从“Line1”的问题事件到“Line3”的恢复事件,从“Line2”的问题事件到“Line4”的恢复事件相匹配,并能逐个关闭这些问题:
为此,需要通过标签将这些事件相关联,例如,可以标识为“Application 1”和“Application 2”。这个过程也可以将正则表达式应用于日志中来提取标签的值。然后,当事件创建时,他们分别给标识为“Application 1”和“Application 2”,并且问题可以与解决方法相匹配
在触发器的配置界面配置事件关联:
所有必须输入的区域都通过红色星号进行标记。
如果配置成功,能够看到标记“application ”的问题事件,并与监测中 → 问题页面看到结果相匹配
<note warning>因为有可能出现错误配置,当为不相关的问题创建相似的事件标签时,请查阅下面标记出来的情况: :::
To begin with, you may want to set up an item that monitors a log file, for example:
With the item set up, wait a minute for the configuration changes to be picked up and then go to Latest data to make sure that the item has started collecting data.
With the item working you need to configure the trigger. It's important to decide what entries in the log file are worth paying attention to. For example, the following trigger expression will search for a string like 'Stopping' to signal potential problems:
To make sure that each line containing the string "Stopping" is considered a problem also set the Problem event generation mode in trigger configuration to 'Multiple'.
Then define a recovery expression. The following recovery expression will resolve all problems if a log line is found containing the string "Starting":
Since we do not want that it's important to make sure somehow that the corresponding root problems are closed, not just all problems. That's where tagging can help.
Problems and resolutions can be matched by specifying a tag in the trigger configuration. The following settings have to be made:
If configured successfully you will be able to see problem events tagged by application and matched to their resolution in Monitoring → Problems.
Because misconfiguration is possible, when similar event tags may be created for unrelated problems, please review the cases outlined below!