Zabbix - Setup Web Scenario Trigger that accepts multiple response codes

Solution 1:

Problem 1:

Item web.test.error returns last error message of scenario as a string. So, your expression

{Template App Nginx by Zabbix agent:web.test.error["Web Check Status 200, 401, 404"].last()}=0

will never fire, as this item will never be 0. Change it to

{Template App Nginx by Zabbix agent:web.test.error["Web Check Status 200, 401, 404"].strlen()}>=0

and logical operator to AND. This will solve the first problem.

Problem 2:

You dont need the item.rspcode<>200 or item.rspcode<>401 or item.rspcode<>404 part. You already specified expected response codes in the web scenario. What happens in your case:

  • Zabbix receives HTTP 200: item.rspcode<>401 and item.rspcode<>404 are TRUE. Trigger is firing.
  • Zabbix receives HTTP 401: item.rspcode<>200 and item.rspcdoe<>404 are TRUE. Trigger is firing.
  • Zabbix receives HTTP 404: item.rspcode<>200 and item.rspcode<>401 are TRUE. Trigger is firing.

Remove aforementioned part from your trigger expression. It should solve problem 2.

TL;DR

Do it like this:

{Template App Nginx by Zabbix agent:web.test.error["Web Check Status 200, 401, 404"].strlen()}>=0 and
{Template App Nginx by Zabbix agent:web.test.fail["Web Check Status 200, 401, 404"].last()}>0