
203
# Execute the
loopback0
command. Verify that the system displays the
loopback0
message and a
policy successfully executed message on the terminal screen.
<Sysname> loopback0
<Sysname>
%Jan 3 09:46:10:592 2014 Sysname RTM/0/RTM_ACTION: loopback0
%Jan 3 09:46:10:613 2014 Sysname RTM/6/RTM_POLICY: CLI policy test is running
successfully.
# Verify that Loopback 0 has been created and assigned the IP address 1.1.1.1.
<Sysname> terminal monitor
<Sysname> display interface loopback brief
Brief information on interface(s) under route mode:
Link: ADM - administratively down; Stby - standby
Protocol: (s) - spoofing
Interface Link Protocol Main IP Description
Loop0 UP UP(s) 1.1.1.1
<Sysname>
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
# Create the Tcl-defined policy
test
and bind it to the Tcl script file.
<Sysname> system-view
[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 TimeRegistered PolicyName
TCL TCL Apr 21 16:33:00 2012 test
# 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 the "rtm_tcl_test is running"
message and a message that the policy is being successfully executed.