[Zabbix3.4] Suppress the occurrence of alerts on specific days of the week using triggers
table of contents
Hello.
My name is Miyazaki and I work in the Operations Management Division of the System Solutions Department.
Today I would like to introduce a trigger that suppresses alerts from occurring on specific days of the week in ZABBIX3.4.
Nakagawa from the Technical Sales Department has also written an article titled [ZABBIX3.4] Setting monitoring exclusion time
Trigger function to specify a specific day of the week
The trigger function that specifies a particular day of the week is "dayofweek".
The following was written in Zabbix Documentation 2.2.
https://www.zabbix.com/documentation/2.2/jp/manual/appendix/triggers/functions
They range from 1 to 7,
1 - Monday,
2 - Tuesday
,
7 - Sunday
, etc.
Below is an example of a trigger condition expression.
The trigger conditional expression is as follows.
{test-wd01:agent.ping.nodata(5m)}=1 and
({test-wd01:agent.ping.dayofweek(0)}=7)=0
The upper conditional expression checks whether the data "agent.ping" of the host "test-wd01" has not responded for 5 minutes using the nodata function.
The lower conditional expression uses the dayofweek function to check what day of the week the data "agent.ping" of the host "test-wd01" is.
This is an expression that connects these with and.
Let's actually test it using the conditional expression builder.
Select Expression Builder and click Test.
If there is no response for 5 minutes on Monday,
return
{test-wd01:agent.ping.nodata(5m)}=1
({test-wd01:agent.ping.dayofweek(0)}=7)=0
Select 1 to say Monday.
The conditions are connected with and, and both are TRUE, so an alert is generated.
If there is no response for 5 minutes on Sunday,
return
{test-wd01:agent.ping.nodata(5m)}=1
({test-wd01:agent.ping.dayofweek(0)}=7)=0
Let's choose 7 and say it's Sunday.
The conditional expression for dayofweek is now FALSE.
Since the conditions are connected with and, the alert will not occur unless both are true.
Trigger explanation
{test-wd01:agent.ping.dayofweek(0)}=7
In the above case, if the value in dayofweek is 7 (Sunday), it will be TRUE.
({test-wd01:agent.ping.dayofweek(0)}=7)=0
However, if you enclose it in () and set =0 at the end, it means to negate what is enclosed in ().
By doing this, if the value entered in dayofweek is 7 (Sunday), it will be FALSE.
summary
As introduced in the link along the way, there are many trigger functions, so it seems possible to write complex conditions.
Also, if I come across any interesting conditions, I would like to introduce them.
That's it.