event application
To specify the event criteria for an Embedded Event Manager (EEM) applet that is run on the basis of an event raised through the EEM Event Publish application programming interface (API), use the event application command in applet configuration mode. To remove the application event criteria, use the no form of this command.
event [tag event-tag] application subsystem subsystem-id type event-type [maxrun maxruntime-number]
no [tag event-tag] event application subsystem subsystem-id type event-type [maxrun maxruntime-number]
Syntax Description
tag |
(Optional) Specifies a tag using the event-tag argument that can be used with the trigger command to support multiple event statements within an applet. |
event-tag |
(Optional) String that identifies the tag. |
2subsystem |
Specifies an identifier for the subsystem that will publish the application event. |
subsystem-id |
Number in the range from 1 to 4294967295 that identifies the subsystem. When an event is to be published by an EEM policy, the subsystem-id reserved for a policy is 798. |
type |
Specifies an event type within the specified event. |
event-type |
Integer in the range from 1 to 4294967295. |
maxrun |
(Optional) Specifies the maximum runtime of the applet. If the maxrun keyword is specified, the maxruntime-number value must be specified. If the maxrun keyword is not specified, the default applet run time is 20 seconds. |
maxruntime-number |
(Optional) Number of seconds specified in ssssssss[.mmm] format, where ssssssss must be an integer representing seconds between 0 and 31536000, inclusive, and where mmm must be an integer representing milliseconds between 0 and 999). |
Command Default
No EEM event criteria are specified.
Command Modes
Applet configuration (config-applet)
Command History
Release |
Modification |
---|---|
12.2(25)S |
This command was introduced. |
12.3(14)T |
This command was integrated into Cisco IOS Release 12.3(14)T. |
12.2(28)SB |
This command was integrated into Cisco IOS Release 12.2(28)SB. |
12.2(18)SXF4 |
This command was integrated into Cisco IOS Release 12.2(18)SXF4 to support Software Modularity images only. |
12.2(33)SRA |
This command was integrated into Cisco IOS Release 12.2(33)SRA. |
12.2(18)SXF5 |
This command was integrated into Cisco IOS Release 12.2(18)SXF5. |
12.2SX |
This command is supported in the Cisco IOS Release 12.2SX train. Support in a specific 12.2SX release of this train depends on your feature set, platform, and platform hardware. |
12.4(20)T |
The tag and maxrun keywords were added to support multiple event statements within an applet. |
Usage Guidelines
An EEM event is triggered when an application calls the EEM Event Publish API with an event specification that matches the subsystem ID and application event type.
Examples
The following example shows how a policy named EventPublish_A runs every 20 seconds and publishes an event to a well-known EEM event type numbered 1. A second policy named EventPublish_B is registered to run when the well-known EEM event type of 1 occurs. When policy EventPublish_B runs, it outputs a message to syslog containing data passed as an argument from EventPublish_A.
Router(config)# event manager applet EventPublish_A
Router(config-applet)# event timer watchdog time 20.0
Router(config-applet)# action 1.0 syslog msg "Applet EventPublish_A"
Router(config-applet)# action 2.0 publish-event sub-system 798 type 1 arg1 twenty
Router(config-applet)# exit
Router(config)# event manager applet EventPublish_B
Router(config-applet)# event application subsystem 798 type 1
Router(config-applet)# action 1.0 syslog msg "Applet EventPublish_B arg1
$_application_data1"