Skip to content
Smarter by Design.Simpler for Business

gtm trigger ​

The gtm trigger command manages the trigger profiles that define the operations to be run outwards while a health scenario is becoming active or passive: sending an HTTP request or running a command in a database. Its panel equivalent is the Trigger Actions screen.

A trigger does not run on its own; it is bound to the activation or deactivation direction of a scenario and runs when that direction is triggered.

Command Summary ​

TR7 WEB-CLI · gtm trigger
# Tab after the command: all of the subcommands
admin@TR7LBWAF01> gtm trigger
add delete list show update
 
admin@TR7LBWAF01> gtm trigger list # list them all
admin@TR7LBWAF01> gtm trigger show <id> # show one
admin@TR7LBWAF01> gtm trigger add name <name> triggerType <type> …
admin@TR7LBWAF01> gtm trigger update id <id> … # change
admin@TR7LBWAF01> gtm trigger delete <id> # delete
admin@TR7LBWAF01>  

Required Fields ​

OrderFieldStatusValue
1nameRequiredThe name of the trigger profile
2triggerTypeRequiredhttp · https · oracle
3addr.ipConditionally requiredOnly http and https; the address the trigger will go to
4addr.portConditionally requiredOnly http and https; the target port
3–5oracleUser · oraclePassword · oracleConnectionStringConditionally requiredOnly oracle; in this type the address and the port are not asked for, it is set up with the connection string

The oraclePassword is not written on the command line; after the command is run, it is asked for on the screen without being seen.

The Common Fields ​

FieldDefaultValue
--v-deviceThe Host deviceFrom which virtual device the trigger will be sent
--namespaceThe default route table of the deviceFrom which route table the trigger will be sent

The HTTP and HTTPS Trigger ​

FieldDefaultValue
--uri—The path and the query to be requested
--methodGETThe request method
--httpBody—The request body
--httpHeaders.0.name · --httpHeaders.0.value—The request headers
--expectedStatusCodes.0200The status codes at which the trigger will count as successful
--contentQuery—The expression to be searched for in the answer content
TR7 WEB-CLI · The HTTPS trigger
admin@TR7LBWAF01> gtm trigger add name switch-to-backup triggerType https addr.ip 10.0.0.80 addr.port 443 \
--uri /api/failover --method POST --expectedStatusCodes.0 200 \
--httpHeaders.0.name Content-Type --httpHeaders.0.value application/json
admin@TR7LBWAF01>  

The Oracle Trigger ​

In the Oracle type the trigger consists of steps that run in order. Every step takes its own index.

FieldValue
--oracleScenario.0.oracleActionThe type of the step: executeCmd or wait
--oracleScenario.0.oracleCmdThe command to be run; only in the executeCmd step
--oracleScenario.0.oracleExpectedTextThe text expected in the answer; only in the executeCmd step
--oracleScenario.0.oracleExpectedMinRowsThe least number of rows expected; only in the executeCmd step
--oracleScenario.0.oracleWaitMsThe duration to be waited; only in the wait step
TR7 WEB-CLI · The Oracle trigger
admin@TR7LBWAF01> gtm trigger add name db-backup triggerType oracle \
oracleUser check oracleConnectionString <connection-string>
Oracle password: ••••••••
# the steps are added afterwards
admin@TR7LBWAF01> gtm trigger update id <id> \
--oracleScenario.0.oracleAction executeCmd --oracleScenario.0.oracleCmd <command> \
--oracleScenario.0.oracleExpectedMinRows 1
admin@TR7LBWAF01>  

Binding the Trigger to a Scenario ​

TR7 WEB-CLI · binding the trigger to a scenario
admin@TR7LBWAF01> gtm trigger list # find the identifier of the trigger
admin@TR7LBWAF01> gtm scenario update id <scenario> --triggerTurn on --triggerTurnActions.0 <trigger>
admin@TR7LBWAF01>  

The same binding is done for the deactivation direction with the --triggerReturn on --triggerReturnActions.0 fields.

Updating and Deleting ​

TR7 WEB-CLI · update and delete
admin@TR7LBWAF01> gtm trigger update id <id> --uri /api/v2/failover
admin@TR7LBWAF01> gtm trigger update id <id> --httpHeaders.delete # remove the headers
admin@TR7LBWAF01> gtm trigger delete <id>
admin@TR7LBWAF01>  

The type can be changed in an update as well; when it is changed, the required fields of the new type have to be given too.

Things to Know ​

  • A trigger does not run without being bound to a scenario. It has to be added to the activation or deactivation direction of a scenario.
  • The actions run in order. If there is more than one trigger in a scenario, they are operated in the order in the list; an action that fails stops the ones after it.
  • The Oracle password is asked for hidden. The other fields are written on the line.
  • The success criterion changes according to the type. On the HTTP side the status code and the content expression, and on the Oracle side the expected text and the number of rows are used.