Configuring Event Handlers (SRC CLI)
Use the following statements to configure event handlers:
To configure an event handler:
We recommend that when you configure event handlers and their actions, you ensure that for any given event, all database operations are performed before any other operations that have permanent effects. This is because if a database error occurs—for example, due to normal contention for database records between different event threads—the SRC VTA rolls back the current database transaction (no changes are made to the database) and then restarts processing the event. If the event performs some other operation other than database operations before such an error, such as start a service, then that other operation is performed again when the event is reprocessed following the error.
From configuration mode, access the statement that configures SRC VTA event handlers. For example, to configure an event handler called evh1 in the SRC VTA group called vta1:
You must not specify the event handler name as all, because the show vta statistics performance group name event-handler command uses the all option to display event statistics of all event handlers.user@host# edit shared vta group vta1 event-handler evh1
Specify an event. For example, to have the event handler handle start events for the service named QuotaInternet:[edit shared vta group vta1 event-handler evh1]]user@host# set events service-start:QuotaInternet
Specify previously configured actions that the event handler invokes in response to the event. For example, to specify the previously configured actions called act1, act2, and act3:[edit shared vta group vta1 event-handler evh1]user@host# set actions [act1 act2 act3]
Specify the condition the event handler uses to determine whether it should handle the event.[edit shared vta group vta1 event-handler evh1]user@host# set condition condition
True—Event handler should handle the event.
False—Event handler should not handle the event.
Specify the priority of the event handler.[edit shared vta group vta1 event-handler evh1]user@host# set priority priority
Event handlers with the lower number priority have the highest priority and evaluate the event first.
Verify your configuration.[edit shared vta group vta1 event-handler evh1]user@host# show