show event manager policy registered
show event manager environment
Running the tm_cli_cmd.tcl Sample Policy
This sample policy demonstrates the ability to periodically execute a CLI command and to e-mail the results.
The CRON specification “0-59/2 0-23/1 * * 0-7” causes this policy to be run on the second minute of each
hour. The policy gathers detailed information about the event and uses the CLI library to execute the
configuration commands specified in the EEM environment variable _show_cmd. An e-mail message is sent
with the results of the CLI command.
The following sample configuration demonstrates how to use this policy. Starting in user EXEC mode, enter
the enable command at the device prompt. The device enters privileged EXEC mode where you can enter
the show event manager policy registered command to verify that no policies are currently registered. The
next command is the show event manager policy available command to display which policies are available
to be installed. After you enter the configure terminal command to reach global configuration mode, you
can register the tm_cli_cmd.tcl policy with EEM using the event manager policy command. Exit from global
configuration mode and enter the show event manager policy registered command to verify that the policy
has been registered.
The timer event detector triggers an event for this case periodically according to the CRON string set in the
EEM environment variable _cron_entry. The EEM server is notified, and the server runs the policy that is
registered to handle this event--tm_cli_cmd.tcl.
enable
show event manager policy registered
show event manager policy available
configure terminal
event manager policy tm_cli_cmd.tcl
end
show event manager policy registered
Running the tm_crash_reporter.tcl Sample Policy
This sample policy demonstrates the ability to send an HTTP-formatted crash report to a URL location. If the
policy registration is saved in the startup configuration file, the policy is triggered 5 seconds after bootup.
When triggered, the script attempts to find the reload reason. If the reload reason was due to a crash, the policy
searches for the related crashinfo file and sends this information to a URL location specified by the user in
the environment variable _crash_reporter_url. A CGI script, interface_tm.cgi, has been created to receive the
URL from the tm_crash_reporter.tcl policy and save the crash information in a local database on the target
URL machine.
A Perl CGI script, interface_tm.cgi, has been created and is designed to run on a machine that contains an
HTTP server and is accessible by the device that runs the tm_crash_reporter.tcl policy. The interface_tm.cgi
script parses the data passed into it from tm_crash_reporter.tcl and appends the crash information to a text
file, creating a history of all crashes in the system. Additionally, detailed information on each crash is stored
in three files in a crash database directory that is specified by the user. Another Perl CGI script,
crash_report_display.cgi, has been created to display the information stored in the database created by the
interface_tm.cgi script. The crash_report_display.cgi script should be placed on the same machine that contains
interface_tm.cgi. The machine should be running a web browser such as Internet Explorer or Netscape. When
the crash_report_display.cgi script is run, it displays the crash information in a readable format.
The following sample configuration demonstrates how to use this policy. Starting in user EXEC mode, enter
the enable command at the device prompt. The device enters privileged EXEC mode where you can enter
the show event manager policy registered command to verify that no policies are currently registered. The
next command is the show event manager policy available command to display which policies are available
to be installed. After you enter the configure terminal command to reach global configuration mode, you
Consolidated Platform Configuration Guide, Cisco IOS Release 15.2(4)E (Catalyst 2960-X Switches)
1810
Configuration Examples for Writing Embedded Event Manager Policies Using Tcl