In this article, I will give an example of creating triggers in Zabbix that can only fire at certain times, and not always.
Once I needed to monitor working SIP phones (online / offline), for this, on the server with asterisk in the Zabbix agent configuration, I added the following parameters:
UserParameter=asterisk.201.online,asterisk -rx "database show" | grep "Registry/201" | wc -l
UserParameter=asterisk.202.online,asterisk -rx "database show" | grep "Registry/202" | wc -l
...
But since SIP phones can turn on during working hours, I made the following triggers:
last(/Asterisk ixnfo.com/asterisk.201.online)=0 and dayofweek()<7 and time()>=080000 and time()<=163000
As you can see, the trigger specifies a day of the week less than 7, that is, from 1-Monday to 6-Saturday, as well as a time that is equal to or more than 8 am and equal to or less than 16:30. Well, of course, the value of the data element is 0.
At the time of writing, I am using Zabbix version 6.0.4.
See my other articles about Zabbix