Alert rules - Time range


Is it possible to build an alert rule to trigger within a specific time range? Ex Working-hours or Non-working-hours?

It is, but if you do it will not trigger alerts/notifications outside that time window, so if something happens at night (supossing night are outside working hours) you will not have an alert log entry.

You can build macros and add them to your config.php. Here is a sample that I just tested for business hours and after hours. You then want to add this to your alert_rules. Remember that you will need to double up your rules. You will need to create rules for Business hours(BH) and After hours(AH). I created rules for AH that delay for 11m so if something just pops then I do not get and email. During BH I have it setup for delay of 6m on alert rules.

Business hours(BH) Mon-Fri (7 am - 5:59 pm)
After hours(AH) Mon-Fri (6 pm - 6:59 am), Sat/Sun(all day)

$config[‘alert’][‘macros’][‘rule’][‘business_hours’] = ‘(HOUR(now()) >= 7 AND HOUR(now()) <= 17) AND WEEKDAY(now()) <= 4’;
$config[‘alert’][‘macros’][‘rule’][‘after_hours’] = ‘(HOUR(now()) <= 6 OR HOUR(now()) >= 18) OR WEEKDAY(now()) >= 5’;