Time range for alert transport

I think time range would be better for alert transport instead of alert template.
In this way the alerts could be continously but could not to disturb users outside the their working hours

My suggestion:

Create a macro that match your working hours, then set 2 alerts.

One with the macro to true with a transport associated and another one without transport.

Check this: Timeperiod in alert

Hi,

I tried your suggestion already, but at the end of working hours I get a fake recovery message. Next morning I get service down message again.

please paste your alert rule. thanks

What’s wrong here?

could you post your business hours macro definition also, please?

$config[‘alert’][‘macros’][‘rule’][‘business_hours’] = ‘(HOUR(now()) >= 8 AND HOUR(now()) <= 16) AND WEEKDAY(now()) <= 4’;

Alert Rule (Screenshot) looks good.

For my intention i would concentrate myself to business_day macro
have you tried:
((HOUR(now()) >= 8 AND HOUR(now()) <= 16) AND WEEKDAY(now()) <= 4)
instead of
(HOUR(now()) >= 8 AND HOUR(now()) <= 16) AND WEEKDAY(now()) <= 4?

Macro for my intention also looks fine, nethertheless i think macro would be the problem.
Have you tried to reduce it’s complexity for debugging and test it?

I don’t think that I have problem with the macro. My problem is that I get fake recovery notification at 17:00, and I get device down notification at 8:00
The recovery notifaction is fake because the device is still DOWN but it is outside working hours… How can I avoid to ACK the alert every morning? Is the only option for that the “scheduled maintenance”?

change max Alerts to 1

-1 means “do every check interval”

on changing it to 1 you’ll be informed only once

Then I’ll be informed only once every day at 8:00 and I will get recovery message at 17:00

nope,
for the port which was going down the alert only will be sent once if max alert is set to 1.
If it goes up …

OH YEAH !!! :smiley: :man_facepalming:

the cause is the business_day macro … so it matches, then it doesn’t match, then it matches again …

it’s like port is down macro against a flapping port, it matches, it matches not, then it matches again …

so it’s every neẃ start of a matching business_day a new alert, even if the ports stays down over days

i think your wish “i want to be informed only in business hours” is a little more complicated and cannot be solved via macros as i see at moment

mmh alerting only in specified time windows has to be a written and included as Feature Request

1 Like

As you can see we are talking in a Feature request ticket :slight_smile:
I would recommend to be configurable per alert transport

Don’t know who has time/is motivated to implement this feature.
If you’d like to implement this it would be very appreciated :slight_smile:

Unfortunately I’m not a developer.

Work in progress https://github.com/librenms/librenms/pull/11622

1 Like

@1soproni, please test the feature!

To apply new feature patch

./scripts/github-apply 11622
php artisan migrate

To revert:

php artisan migrate:rollback --step=4
./scripts/github-remove -d

Hi,

thx for the patch and for your effort.
I tried to set it, but I cannot set greater “start hour” (and minutes (should be renamed to start time)) than the actual time(neither with the arrows, nor with the selector)


The “end hour” (end time) cannot be set to lower than the actual time.
E.g.: The time is 7:00 now. I cannot set the start hour to 8:00
Hmmm, okay I leave the text above here because that was the status. But I tried to set lower start time than the actual, went lower than midnight and finally I could set it to any time. After that works well the start and also the time settings.

I think the “Only on weekday:” text is also pointless. (But English is not my native language) You should change it e.g. to “Only on theese day(s)” or “Only on weekday” should be a button which marks the weekdays (Mo-Fr) but it depends on country… BTW: clicking on the text of “Only on weekday” ticks Monday

I’m trying to save the transport. Ticked “All devices except in list” and did not select any device from the list. In this scenario should not it include all the devices?