Agent Task - Scheduling
Agent Task Scheduling
Watch the videoAgent Gateway Tasks
Agent Gateway tasks are enormously useful for applying an action to many agent Gateways at once. To create a new task, or to view running tasks, navigate to Configure > Enterprise Administration > Agent Tasks. The Gateway Tasks page will display scheduled tasks, currently executing tasks, unscheduled tasks that can be run on demand, and task history.
To create a new task, click the Create new Gateway Task link. The EAM wizard will guide you through each step of a Gateway task.
Step 1: Choose Type
Select the type of task you wish to execute. After you selected a type of task, click the Next button.
Step 2: Task Scheduling
Set the task name to a descriptive name of your choice. The following scheduling options are available:
- Execute Immediately: the task will begin execution as soon as you complete the wizard.
- Execute On Demand: the task will not be scheduled, but is available for immediate execution at any time after you complete the wizard.
- Execute Once, Scheduled: the task will run once at the date and time that you specify.
- Execute Once, Delayed: the task will run once after the specified number of seconds, minutes, hours, or days.
- Execute On Schedule: this type of schedule uses UNIX cron type scheduling, where a pattern of 5 numbers determines the recurring schedule. For example, “30 3 * * *” means run a task every day at exactly 3:30 AM. Use the dropdowns next to the pattern textboxes to build out the pattern for the schedule.
After you determined your task schedule, click Next.
Step 3: Agent Selection
In this step, select the agent groups or individual agents that will be included when the task executes. You can select agents that are not currently connected, but you cannot select pending agents.
Depending on the type of task, you may need to complete another page to add some information required for that task. If not, you can click the Finish button to schedule the task.
Gateway Task Results
Gateway task execution is reported in the agent_events table in the controller’s configured database. The individual result of the task execution for each agent is report as a separate entry. For example, the following query will return the results of all task executions:
select * from agent_events where event_category = 'task' order by event_time desc;
A task that completed normally for an agent will contain the text NORMAL in the event_level field. If an error occurred for an agent, the event_level field is set to ERROR, and the error message is recorded in the message field.
Running a Task Outside its Schedule
You can run any task outside the task’s normal schedule by clicking the More button and “run now” link on the right side of the task. Keep in mind:
- Tasks that have been scheduled to run immediately are already running, and the “run now” link will not be visible.
- A task that has been scheduled to execute only once at a scheduled time or after a delay will be rescheduled to run immediately. The task will not run again after it has been rescheduled.
- A scheduled task will continue to run at its normally scheduled time, even if you run the task now.
Pausing and Canceling Tasks
Pause and Resume
After most tasks are created, they are put onto the task schedule. The exception to this is on demand tasks, which are not put on the schedule until you click the "run now" link. After a task has been added to the schedule, you can pause and resume the task. The state of the task (scheduled, running, waiting) and the scheduling configuration affect how the task is paused and resumed.
Task Configuration | Pause Action | Resume Action |
---|---|---|
Task is currently running or waiting | System will attempt to cancel outstanding calls to remote servers. | System will run the task again against any servers that were outstanding when the task was paused. |
Task is scheduled once at a specific date and time | The task will be temporarily taken off the schedule. | If the specified time has not yet arrived, the task will be put back onto the schedule at the original time. If the specified time has already passed, the task will execute immediately upon resume. |
Task is scheduled once after a specified delay | The task will be temporarily taken off the schedule. | The task will be put back onto the schedule at the original calculated time. For example, if the delay is set to 2 hours, and the task is paused for 1 hour, the task will fire in 1 hour after resume. If the delay period has already passed, it will fire immediately after resume. |
Task is on a recurring schedule | All future iterations of the task will be temporarily taken off the schedule. | The task will not fire if task iterations have been missed when the task was paused. The task will return to firing on its normal schedule. |
Cancel
Scheduled one-shot tasks can be cancelled at any time before the task starts. Scheduled one-shot tasks include tasks that are scheduled to fire once after a delay or fire at a specific time. Running tasks can also be cancelled, but there are no guarantees about how much of the task is processed at the time of cancel. Keep in mind that cancelling a task will cause also delete the task at the same time, and it cannot be retrieved after cancel.