[Zabbix 3.4] Suppressing alerts on specific days of the week with triggers
Hello
My name is Miyazaki and I work in the Operations Management Division of the System Solutions Department
Today, I'd like to introduce a trigger in Zabbix 3.4 that suppresses alerts on specific days of the week.
Nakagawa from our Technical Sales Department[Zabbix 3.4] Setting Monitoring Exclusion Times,has also written an article titled
Trigger function for specific days of the week
The trigger function to specify a specific day of the week is "dayofweek"
The following information was found in Zabbix Documentation 2.2:
https://www.zabbix.com/documentation/2.2/jp/manual/appendix/triggers/functions
There are 1 through 7, with
1 being Monday,
2 being Tuesday
, ..., and
・
7
being Sunday.
Below are some examples of trigger expressions:

The trigger condition is as follows:
{test-wd01:agent.ping.nodata(5m)}=1 and
({test-wd01:agent.ping.dayofweek(0)}=7)=0
The upper conditional expression checks if the "agent.ping" data for the host "test-wd01" has not responded for 5 minutes using the nodata function.
The lower conditional expression checks what day of the week the "agent.ping" data for the host "test-wd01" is from using the dayofweek function.
These two conditions are connected by "and".
Let's actually test it using the conditional expression builder.
Select the conditional expression builder and click Test.

If there is no response for 5 minutes on Monday
, {test-wd01:agent.ping.nodata(5m)}=1
returns 1, indicating no response for 5 minutes.
({test-wd01:agent.ping.dayofweek(0)}=7)=0
selects 1, indicating it is Monday.

The conditions are connected with "and", and since both are TRUE, an alert is triggered.
If there is no response for 5 minutes on Sunday,
{test-wd01:agent.ping.nodata(5m)}=1
returns 1, indicating no response for 5 minutes.
({test-wd01:agent.ping.dayofweek(0)}=7)=0
selects 7, indicating Sunday.

The dayofweek condition expression became FALSE.
Because the conditions are connected with "and", an alert will not be generated unless both are TRUE.
Trigger Description
{test-wd01:agent.ping.dayofweek(0)}=7
In the above case, if the value entered in dayofweek is 7 (Sunday), it will be TRUE.
({test-wd01:agent.ping.dayofweek(0)}=7)=0
However, if you enclose it in parentheses and then add =0 at the end, it means that the contents inside the parentheses are negated.
In this way, if the value of dayofweek is 7 (Sunday), it will be FALSE.
summary
As mentioned in the link, there are many trigger functions, so it seems possible to write complex conditions.
I'll share any interesting conditions I come across.
That's all
0
