NetXMS Support Forum

English Support => General Support => Topic started by: millerpaint on June 13, 2012, 04:11:41 AM

Title: Host polling - exclusion window
Post by: millerpaint on June 13, 2012, 04:11:41 AM
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

Title: Re: Host polling - exclusion window
Post by: Victor Kirhenshtein on June 15, 2012, 12:27:54 PM
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
Title: Re: Host polling - exclusion window
Post by: millerpaint on October 23, 2012, 07:03:38 PM
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
Title: Re: Host polling - exclusion window
Post by: Victor Kirhenshtein on October 24, 2012, 11:04:15 PM
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
Title: Re: Host polling - exclusion window
Post by: millerpaint on October 25, 2012, 12:16:35 AM
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