|
Scheduling Device Downtime |
Top Previous Next |
|
Often, a device should undergo maintenance during a pre-determined period of time. This means that device will not be available for AggreGate during that period and it should not be synchronized with the server. The system should not generate any warnings about device unavailability during such scheduled downtime. This tutorial illustrates how to use a device dependency expression to suspend device synchronization for a specified time. Although dependency expressions are most often used to check the status of another device and disable synchronization if said device is down, they may be also used to check the current time. Scheduling Downtime for an Absolute Time Period In this case, we'll set up a dependency expression that resolves to FALSE within a certain span of time and to TRUE otherwise. We'll use the now() function that returns current timestamp (i.e. time of dependency check) and date() function that constructs a timestamp from year, month, day, hours, minutes, and seconds arguments. Descriptions of these functions are available in expression functions reference. Note that month argument of date() function is zero-based, so we must pass 0 for January. Let's schedule device downtime for 08 Feb 2010 from 18:00 to 20:00. Here is our dependency expression: now() < date(2010, 1, 8, 18, 0, 0) || now() > date(2010, 1, 8, 20, 0, 0) Device account properties in AggreGate Client:
An expression that schedules a whole maintenance day: now() < date(2010, 1, 8, 0, 0, 0) || now() > date(2010, 1, 9, 0, 0, 0) Scheduling Periodic Downtime Same method may be used to schedule periodic downtime. In this case, dependency expression will use some other date/time processing functions to check the output of now() function. Here is a dependency expression that disable device synchronization every Monday: dayOfWeek(now()) != 1 Note, that dayOfWeek() function returns zero for Sunday. "Not equals" operator is used, as the dependency expression must return TRUE (to enable sync) when the current day is not Monday. To schedule downtime every Wednesday from 22:00 to 23:00: !(dayOfWeek(now()) == 3 && hour(now()) > 22 && hour(now()) < 23)
|