Configuring Event Handlers (SRC CLI)

Use the following statements to configure event handlers:

shared vta group name event-handler event-handler-name {events events;actions actions;condition condition;priority priority;}

To configure an event handler:

Note: 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.

  1. 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:
    [edit]user@host# edit shared vta group vta1 event-handler evh1
  2. 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
  3. 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]
  4. 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

    Specify the condition as script written in the JavaScript programming language that must return one of the following Boolean values:

    • True—Event handler should handle the event.
    • False—Event handler should not handle the event.
  5. 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.

  6. Verify your configuration.
    [edit shared vta group vta1 event-handler evh1]user@host# show

Related Documentation