I check if error occurred by checking whether the last value matches regexp.
({myhost.com:my.item.regexp(^ERROR$)})#0
I need some tolerance by checking not last but last N values to match the regexp, i.e. last 2-3 values.
How can I achieve that?
Best Answer
According to Zabbix function documentation, function regexp() accepts a second parameter - the number of seconds or values to analyze. Unfortunately, it will return 1 if at least one of the values matches, which is not what you need - you need all values to match.
Therefore, if your regular expression is simple enough, consider using count() function with "eq" or "like" operators:
There is also a feature request to be able to use regular expressions in count() function and it is tracked at ZBXNEXT-1250.