Skip to content
Ask AI

Event Manager

The Event Manager feature allows users to predefine a set of CLI commands (actions) and bind them to the down event of a specified interface. When the monitored interface status changes to down, the system automatically executes a predefined command sequence to achieve configuration rollback, fault self-healing, or automated operation and maintenance. This function can reduce manual intervention time and improve the reliability and maintainability of the network.

The event manager consists of multiple user-defined applets. Each applet contains the following elements:

  • Name: uniquely identifies an applet.
  • Trigger point: Currently only supports interface down events, which monitor the status of a physical interface or LAG interface. When the interface status changes to ‘down’, the applet is triggered.
  • Action List: A set of CLI commands executed in sequence. Each action has a priority ID (ranging from 0 to 9999.9999, integers or positive floating point numbers), with smaller IDs being executed first. When a command contains spaces, double quotation marks should be used to wrap it.
  • Log switch: can enable the warning function, generate system logs when the applet is triggered for execution, and facilitate post audit.

When a down event occurs in the monitored interface, the system automatically calls the bound applet and executes the preset CLI command in ascending order of action ID to complete the automation operation.

OperationCommandDescription
Enter the system configuration viewconfigure terminal
Create/Delete Appletevent manager applet String
no event manager applet String
Create or remove an event management applet. < string > is an applet name. Proceed to the applet configuration view.
Configure action commandsaction * actionid cli command String
no action
actionid*
Add or remove a CLI command as an action for the applet. is the priority ID (0~9999.9999), the smaller the number, the earlier it will be executed; is a command string, double quotation marks are required when containing spaces.
Turn on/off logswarning enable
no warning enable
Enable or disable the logging function when triggered by the applet. The default is closed.
Bind down eventdown event applet String
no down event applet
Bind the specified applet to the down event of the current interface in the interface configuration view or LAG group configuration view. When the interface status changes to ‘down’, trigger the applet.
View Applet Informationshow event-manager-appletExecute in the system view and display all configured event management applets, including name, action list, log switch status, and trigger point information.

Networking Requirements

When the device is initially deployed, there is already a stable configuration (such as interface Ethernet 1 in up state and BGP process 65100 running normally). Subsequently, in order to test the new network, the configuration of Ethernet 1 was modified (shutdown was performed and BGP configuration was deleted). Requirement: When the link status of monitoring interface Ethernet 3 changes to down, automatically execute a rollback command to reactivate Ethernet 1 and restore BGP configuration. Simultaneously enable logging for post audit purposes.

Configuration Steps

1. Create an Event Management Applet

Create an Applet named ‘test’ and enter the Applet Configuration View

sonic(config)# event manager applet test
sonic(config-event-applet-test)#

2. Configure pre configured commands (action list)

Add the CLI commands that need to be executed in order

sonic(config-event-applet-test)# action 1 cli command "interface ethernet 1"
sonic(config-event-applet-test)# action 2 cli command "no shutdown"
sonic(config-event-applet-test)# action 3 cli command "exit"
sonic(config-event-applet-test)# action 4 cli command "router bgp 65100"
sonic(config-event-applet-test)# action 5 cli command "neighbor 10.0.0.1 remote-as 65100"
sonic(config-event-applet-test)# action 6 cli command "exit"

3. Enable logging

Enable the warning function to generate logs when the applet is triggered.

sonic(config-event-applet-test)# warning enable
sonic(config-event-applet-test)# exit

4. Bind down event to interface

Enter the interface that needs to be monitored (such as Ethernet 3), and trigger the test applet when the interface goes down

sonic(config)# interface ethernet 3
sonic(config-if-Ethernet3)# down event applet test
sonic(config-if-Ethernet3)# exit

5. Verify configuration

Use the show event-manager-applet command to view the configured event management applet and its detailed information

sonic# show event-manager-applet
+--------+-----------------------------------+------------------+--------------------+
| name   | action                                  | warning enable    | triggering point    |
+========+==============================+==============+==========+==================+
| test   | interface ethernet 1                    | enabled           | Ethernet3--down     |
|        | no shutdown                             |                   |                     |
|        | exit                                    |                   |                     |
|        | router bgp 65100                        |                   |                     |
|        | neighbor 10.0.0.1 remote-as 65100       |                   |                     |
|        | exit                                    |                   |                     |
+--------+-----------------------------------+----------------+-----------------------+

sonic# show event-manager-applet +--------+-----------------------------------+------------------+--------------------+ | name   | action                                  | warning enable    | triggering point    | +========+==============================+==============+==========+==================+ | test   | interface ethernet 1                    | enabled           | Ethernet3—down     | |        | no shutdown                             |                   |                     | |        | exit                                    |                   |                     | |        | router bgp 65100                        |                   |                     | |        | neighbor 10.0.0.1 remote-as 65100       |                   |                     | |        | exit                                    |                   |                     | +--------+-----------------------------------+----------------+-----------------------+

Explanation: When the link status of interface Ethernet 3 becomes down, the system will automatically execute commands in the order of actions 1-6 to reactivate Ethernet 1 and restore BGP configuration. At the same time, warning enable will trigger logging, and event execution records can be viewed through the logs.