Tcl-Defined Policy Configuration Example - HP 5920 Configuration Manual

Table of Contents

Advertisement

Tcl-defined policy configuration example

Network requirements
Use Tcl to create a monitor policy on the device. This policy must meet the following requirements:
EAA sends the log message "rtm_tcl_test is running" when a command that contains the display
this string is entered.
The system executes the command only after it executes the policy successfully.
Configuration procedure
# Edit a Tcl script file (rtm_tcl_test.tcl, in this example) for EAA to send the message "rtm_tcl_test is
running" when a command that contains the display this string is executed.
::comware::rtm::event_register cli sync mode execute pattern display this user-role
network-admin
::comware::rtm::action syslog priority 1 facility local4 msg rtm_tcl_test is running
# Download the Tcl script file from the TFTP server at 1.2.1.1.
<Sysname> tftp 1.2.1.1 get rtm_tcl_test.tcl
# Enter system view.
<Sysname> system-view
# Create the Tcl-defined policy test and bind it to the Tcl script file.
[Sysname] rtm tcl-policy test rtm_tcl_test.tcl
[Sysname] quit
Verifying the configuration
# Display information about the policy.
<Sysname> display rtm policy registered
Total number: 1
Type
Event
TCL
TCL
# Enable the information center to output log messages to the current monitoring terminal.
<Sysname> terminal monitor
# Execute the display this command. Verify that the system displays "rtm_tcl_test is running" and a
message about the policy being successfully executed.
<Sysname> display this
#
return
<Sysname>%Jun
%Jun
4 15:02:30:382 2013 Sysname RTM/6/RTM_POLICY: TCL policy test is running
successfully.
TimeRegistered
Apr 21 16:33:00 2012 test
4 15:02:30:354 2013 Sysname RTM/1/RTM_ACTION: rtm_tcl_test is running
PolicyName
218

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

5900

Table of Contents