Host polling - exclusion window
-
Greetings,
Is there a way to exclude a window of time during which hosts on specific subnets will not be polled? For instance, I would like to not poll hosts between 6pm-7pm PST, because this is a time when many host machines are automatically restarted.
-Kevin
-
Hi!
You cannot exclude hosts from the poll. However, you can ignore down events in specific time interval by using appropriate filter script in event processing policy.
Best regards,
Victor -
Hi Victor,
My goal is to not get any node down alerts between 6pm and 10pm. I have this filtering script in my event policy - this is my first script, so please bear with me

sub main()
{
now = localtime();
return (now->hour <= 18 || now->hour >= 22);
}It is not working (I receive alerts during the time window). Also, after I get this working, I will need to specify another time window for the weekends (Saturday and Sunday).
Any advice is appreciated!
-Kevin
-
Hi!
Actually, this script will filter out time from 19:00 to 22:00, not from 18:00 - because even for 18:59 condition now->hour <= 18 will be true. You either should lost 1 minute, and use now->hour <= 17, or use condition like
(now->hour < 18 || now->hour >= 22 || (now->hour == 18 && now->min == 0))
If you need to add Saturday and Sunday, you can use script like this:
now = localtime(); if (now->wday == 0) return /* sunday-specific check */ if (now->wday == 6) return /* saturday-specific check */ return (now->hour < 18 || now->hour >= 22 || (now->hour == 18 && now->min == 0));Best regards,
Victor -
Ah, of course. I did not take into account the 59 minutes, and 59 seconds! I will also look at the Saturday and Sunday code example you provided.
Thank you!
-Kevin
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login