What is a Trigger Action; what does it do in which situations?
Short answer
Trigger Action is the operation that GTM performs on an external system when the condition of a Health Scenario changes: in the HTTP / HTTPS type, an HTTP request is sent to the defined address; in the Oracle type, a connection is made to the database and the commands are run in order. An action is neither run on its own nor run manually; With Trigger is selected in the Activation or Deactivation setting of the scenario, the action is added to the Activation Trigger → / Deactivation Trigger ← list, and it runs in the list order when the condition of the scenario is met or broken. The action does not change the DNS answer; in a Disaster Recovery switchover, it is used to prepare the systems in the backup data center (e.g. a database, an automation API) for the switchover, and the switchover is completed by the Activation Check / Deactivation Check condition of the scenario.
How Does It Work?
- When the Health Check condition of the scenario is met, the Activation Trigger → list is started, and when it is broken, the Deactivation Trigger ← list. When the scenario is first added, the action does not run; it runs only at the later changes of the condition.
- The actions run one at a time, in the list order. After a successful action, the next one in line is started; a failed action stops the rest of the list and no retry is made. If the condition changes again while actions are running and the list of the other direction starts, the running actions are stopped first.
- Regardless of the result of the actions, the scenario becomes active (or passive) when the Activation check (or Deactivation check) condition is met (What is a health scenario; how does it combine several checks?).
- The start, the result and the error text of each run are written to the GTM Logs screen as a Trigger Action event (Operating Mechanism).
Trigger Types
| Trigger Type | What it does | To be considered successful |
|---|---|---|
| Oracle (default) | Connects with User, Password and Connection String; runs the Execute Command and Wait(ms) steps in order (Step list) | The connection must be established; for each command, Expected Text, if filled in, must be found in the result, and at least Expected Number of Rows rows must be returned |
| HTTP | Sends a request to the Address (an IP or a domain name, and a port) and Path + Query target with Method, HTTP Headers and HTTP Body | The response code must be in the Expected Status Codes list (default 200); if Content Check Mode is defined, the content condition must be met; the request must complete within 120 seconds |
| HTTPS | Sends the same request over TLS | In addition to the HTTP conditions, the server certificate must be verifiable |
Redirect responses (3xx) are not followed; a 3xx code is also evaluated according to the Expected Status Codes list.
Trigger Action in TR7
- Screen: Trigger Actions under Configuration Menu → GTM. An action is also defined with the Add button of the Activation Trigger → / Deactivation Trigger ← selector in the scenario form.
- Where it runs: The action is run over the Route Table selected in the form; the target system must be reachable from this route table.
- No status: There is no status circle in the list or in the preview; the run results are seen on the GTM Logs screen, in the Log window of the action and of the scenario, and in the Latest Actions rows of the scenario preview. The scenarios that use the action are listed in the Used in tab of the preview (Preview of the Selected Action).
- Cluster: Only the device whose Cluster ID value is 1 runs the actions; if the peer device cannot reach this device for longer than one hour, it takes over the task (How does GTM behave in a cluster?).
Common Misconceptions
- "A trigger action starts the Disaster Recovery switchover." The switchover is determined by the decision of the scenario; the action prepares the external system.
- "When the action succeeds, the scenario becomes active." It is the Activation check condition that makes the scenario active; the success of the action does not directly change the decision.
- "A failed action is retried." It is not; the next actions in the list do not run either. An action whose success is mandatory is placed at the beginning of the list.
- "The action can be tested from this screen." The screen has no run or test button; the action runs only when the condition of the scenario changes.
How it is done in the documentation
