Triggers And Practical Usage

Applies To: AutoMate 6, AutoMate 5
Published: 10/26/06

Introduction
Triggers are events that cause a task to run. These include a schedule, when a file is added, removed or modified, when the system is Idle, when an entry is written to the system event log, when certain hardware performance thresholds are reached, when a hot-key is pressed and much more. When a task is "triggered" the steps within the task are executed. This article will provide a general description and overview of each trigger contained in AutoMate as well as some practical uses.

Important Notes
Triggers are constructed in the Task Administrator in the Managed Task Properties of each task. To access trigger settings for tasks, open the Task Administrator, double click the task or click the task and select "Properties" from the toolbar and navigate to the 'Triggers' tab.

At least one trigger needs to be attached to the task In order to launch a task automatically.

Multiple triggers of the same or differing types may be attached to a single task. Attaching multiple triggers acts as an "OR" condition (as opposed to an "AND" condition). Therefore, any of the attached triggers will launch the task.

Every available trigger (with the exception of the File Watcher) incorporates a 'Counter' tab, which has the option "Trigger after condition has been met:" This option specifies how many times the trigger condition must be met before the task is started. The default value is "1."

When a task is triggered, it automatically creates a dataset called AMTrigger. This dataset can be used within a task to determine whether or not the task was started by a trigger, which trigger it was, and properties of that trigger. Also, more Information regarding the use of AMTrigger can be found in the AutoMate Help system by entering "AMTrigger" in the 'search' field.

Additionally, the user has the option to use no triggers and instead run a task manually from the Task Administrator or Task Builder by clicking the 'Run' button.

Event Log Watcher

Description
The Event Log Watcher launches a task when an event is added to the Windows Event Log (located in 'Control Panel' -> 'Administrative Tools' -> 'Event Viewer').

Practical Usage
Commonly used to make AutoMate act in response to system or application generated errors, warnings, successes or failures that are sent to the Windows

Event Log

Example: The Event Watcher can automatically launch a task that emails the system administrator if Windows generates a log entry stating that the DNS server could not be contacted.

File Watcher

Description
The File Watcher monitors specified folders and launches a task when files are either added, modified, deleted or any combination of the events listed. In addition, it can launch a task when one file, a number of files or the folder size exceeds a certain size.

Practical Usage
Most frequently used to monitor folders for incoming files. When these files arrive, they can be automatically copied, read, uploaded, moved, renamed, etc. in the launched task.

Note:
File Watcher triggers will work on network drives and shares only if the machine is part of a domain or workgroup and if the machine AutoMate is running on has at least read access to the folder being watched. In addition, network folders need to be specified via UNC (Universal Naming Convention) path instead of a mapped drive. (Example: Z:\Pathname\Foldername should be \\Servername\Pathname\Foldername) This is because mapped drives can be created and used only when a user is logged on and are unavailable when the user is logged off.

Idle Watcher

Description
This trigger launches a task when no keyboard or mouse input occurs for the specified period of time (e.g. the system goes idle).

Practical Usage
Occasionally tasks are better run when the machine is not in use by a real person. The Idle Watcher trigger allows the user to launch a task in this manner.

Note:
Some machines may become locked or a screensaver may appear (which automatically locks a machine) within a specific time period. In this case, make sure that the task's "Log On" parameters are set to unlock the workstation when it is locked.

Key Watcher

Description
The Key Watcher launches a task when a hotkey is pressed (e.g. Alt + A) or when an AutoKeys phrase is entered (e.g. a specified word is typed on the keyboard). Additionally, the event can be configured to occur only when a specific application is active and/or has focus.

Practical Usage
This trigger is useful for creating hotkey "shortcuts" for repetitive multi-step processes.

Example: Instead of entering a username manually,
A user could create an AutoKeys phrase of "un". When "un" is typed, a task using Send Keystrokes to type out a username is triggered.

Performance Watcher

Description
The Performance watcher trigger launches a task when a system or process threshold is met. This includes available memory, free disk space, CPU utilization, process count, thread count (per application or system wide) and elapsed time (per application or system wide) in minutes, seconds or hours.

Practical Usage
The Performance Watcher is commonly used to monitor a server or workstation for certain performance characteristics or thresholds. This is useful for servers in a "back office" environment.

Example 1: Using the Performance Watcher trigger, if available memory is too low, the specific process(es) or the entire system could be automatically restarted.

Example 2: If disk space is too low, a notification message could be sent to the system administrator.

Example 3: If an application's thread count is too high, an email message could be sent to the system administrator.

Process Watcher

Description
The Process Watcher can launch a task when a specified process starts, ends or stops responding. A drop-down arrow can be used to select a process that's currently running or the user has the option to manually enter the process name. To indicate partial process names, use wildcard characters (e.g. * or ?).

Practical Usage
The Process Watcher trigger is frequently used to monitor external applications for unexpected crashes. It can also be used to start a task when an external application starts, ends or stops.

Example: If a certain process unexpectedly stops, a task can automatically launch to send an email notifying the system administrator.

Schedule Watcher

Description
The Schedule Watcher launches a task at the date, time or interval specified. It has the option to exclude certain days of the week or month, create a custom schedule and a rescheduling option for when a task is late.

Practical usage
The Schedule Watcher is the most commonly used trigger. It can be used for scheduling tasks to run at night or at the end of every day, week, month or other time frame. A custom schedule can be created where a task will run only on the custom dates and times specified. In addition, the "Exclude" option can be used to exclude task execution on certain days of the week, month or year. Additionally, it includes a rescheduling option in case a task is late. This can occur if the computer was turned off or the AutoMate Task Service was not running or was disabled when the task was scheduled to run.

Scheduling Options:
Days: The task will run once every X number of days (except days or times matching exclusions specified in the Exclude tab.)

Hours: The task will run once every X number of hours (except days or times matching exclusions specified in the Exclude tab.)

Minutes: The task will run once every X number of minutes (except days or times matching exclusions specified in the Exclude tab.)

Seconds: The task will run once every X number of seconds (except days or times matching exclusions specified in the Exclude tab.)

Specific Days of the Week: The task will run once or more per X number of weeks on the days specified (except days or times matching exclusions specified in the Exclude tab.) Use this option if a task should run Monday through Friday only.

Specific Days of the month: The task will run once or more per X number of months on the days specified (except days or times matching exclusions specified in the Exclude tab.) Use this option is a task should run at the end of the month regardless of the actual numeric date. Selecting this option reveals several other useful options for specifying task run times.

Custom Schedule: The task will run only on the custom dates and times specified (except days or times matching exclusions specified in the Exclude tab.) Use this option if there is no regular interval for the task to automatically reschedule on.

Exclude Options
Specific Days of the Week: Used to exclude certain days of the week such as weekends.

Specific Days of the Month: Used to exclude certain days of the month such as the first workday of every month.

Specific Days of the Year: Used to exclude certain days of the year such as holidays.

End Date
The End Date specifies the date and time in which a current schedule will end. This is useful for certain tasks that need to run only for a certain time period (e.g. a project that includes a deadline).

Rescheduling Options
When a task is late
The following options can be selected:

1. Immediately run the task: If a task was unable to launch at it's scheduled time, it will launch as soon as it is able to do so.

2. Don't run the task at all: The task will not run if it's late. Instead, it will run at its next normally scheduled time.

3. Prompt for what to do: A message will appear prompting the user whether or not to run the task.

Reschedule the task
The following rescheduling parameters can be selected whenever a task is run after it's scheduled time:

1. Relative to originally set time: The task will be rescheduled to run in relation to the time it was originally scheduled.

2. Relative to the time the task was launched: The task will be rescheduled to run relative to the time that it was actually launched.

For example: A task is scheduled to trigger every hour starting today at 12:00:00 am. The server shut down, causing the task to miss it's schedule and "run late" at 1:12am.
If 'Relative to originally set time' was selected, the task will be rescheduled to launch at 2:00 am.
If 'Relative to the time the task was launched' was selected, it will be rescheduled to launch at 2:12 am.

3. Disable the task: This option will disable a task from running, either automatically or manually. The user can enable it via the Task Administrator or another task can enable it using the 'Enable Task' action.

Service Watcher

Description
The Service Watcher launches a task when the specified service starts, stops, pauses, resumes, stops responding, is installed or removed. The user can select a currently running service via dropdown menu or enter the service manually. To indicate partial service names, wildcards can be used (e.g. * or ?).

Practical usage
The Service Watcher is frequently used to monitor service applications for unexpected crashes.

Example: If the specified service suddenly stops, a task can launch to restart the service and email a message regarding service stoppage to the appropriate recipient.

SNMP Trap Watcher

Description
The SNMP Trap Watcher launches a task when an SNMP trap is received. An SNMP trap is a message sent by an agent to a management system indicating that an event has occurred on the host running the agent.

Note: The SNMP Trap Watcher is only available in the AutoMate Enterprise Edition.

Practical Usage
Used to integrate tasks with other network systems management software

Parameters

Host
This option specifies whether the trigger will listen to traps sent by any host or a specific host. The available options are:

Any Host: The trigger will listen to traps sent from any host.

Specific Host: The trigger will only listen for traps sent by the host specified in the "Specific Host" parameter. The specific host parameter should contain either an IP address or computer name.

Community
This specifies whether the trigger will listen to traps sent to any community or a specific community. A community is a name used to group SNMP hosts. This name is placed in SNMP messages sent between SNMP-managed devices such as Windows 2000-based server computers and SNMP management stations. Typically, all hosts belong to Public, which is the standard name for a common community of all SNMP hosts. The available options are:

Any Community: The trigger will listen to traps sent from any Community.

Specific Community: The trigger will only listen for traps sent by the community specified in the "Specific Community" parameter.

Object Type
The object Type specifies whether the trigger will listen to traps sent by any object or a specific object. The available options are:

Any Object: The trigger will listen to traps sent from any Object.

Specific Object: The trigger will only listen for traps sent by the community specified in the "Specific object" parameter.

Trap Generic Type
The Trap Generic Type specifies whether the trigger will filter out traps that are not intended for a specific generic type.

Trap Type Code
The Trap Type Code specifies whether the trigger will filter out traps that do not have a specific type code. The available options are:

Any Code: The trigger will listen to traps sent with any Code.

Specific Object: The trigger will only listen for traps sent with the code specified in the specific code parameter.