News:

We really need your input in this questionnaire

Main Menu

Email alert time specific

Started by mjk, January 25, 2022, 07:24:31 PM

Previous topic - Next topic

mjk

Hi guys

I am struggling to get 24/7 and 0800-1800 m-f alerts on different devices.
Currently i have them container based, so i can just say "anything in 24/7 container just alert" and stop event processing

The problem comes with the weekday alerts
i have tried to find details in the forums and found weekdays and the times, my issue is how do i add BOTH of these!

my example i have mushed together is -


sub main()
{
now = localtime();
return (now->hour >= 8) && (now->hour < 18);
t = localtime();
return (t->wday >= 1) && (t->wday <= 5);

}


Basically this will only send an alert for issues between 0800- 1800 Monday to Friday..
My next problem will be to create alarms if they are still down come 0800!
I have also created an event which will raise and alarm and not email, as i was finding the device offline but no alarm in the object..

I really am struggling to validate if the rules work, i changed to sat/sun, to test and changed the time, but they both need to be true..

Thanks

mjk

I think i have it down with this filtering script on the alerts

sub main()
{
now = localtime();
return (now->hour >= 8) && (now->hour < 18) && (now->wday >= 1) && (now->wday <= 5);
}


If you use scheduled maintenance plans it will also do a similar thing, but i still wanted to note when it had gone down, and send those notes (or read them) when we got it.

So i have a EPP that just sayd "notify when down - no alerts, and that adds a custom entry for the exact time it went down)
I'll figure out how to run a task to alert on all down systems at 0800 that grabs that data from the custom field another time!
For now, i just dont want our  9-5 customers being charged for 24/7 work!