- Table of Contents
-
- 11-Network Management and Monitoring Configuration Examples
- 01-H3C_S7500E_NQA_Configuration_Examples
- 02-H3C_S7500E_NTP_Configuration_Examples
- 03-H3C_S7500E_SNMP_Configuration_Examples
- 04-H3C_S7500E_EAA_Configuration_Examples
- 05-H3C_S7500E_Mirroring_Configuration_Examples
- 06-H3C_S7500E_NetStream_Configuration_Examples
- 07-H3C_S7500E_sFlow_Configuration_Examples
- Related Documents
-
Title | Size | Download |
---|---|---|
04-H3C_S7500E_EAA_Configuration_Examples | 117.91 KB |
H3C S7500E EAA Configuration Examples
Copyright © 2015 Hangzhou H3C Technologies Co., Ltd. All rights reserved. No part of this manual may be reproduced or transmitted in any form or by any means without prior written consent of Hangzhou H3C Technologies Co., Ltd. The information in this document is subject to change without notice. |
|
Contents
Example: Configuring an interface event monitor policy by using Tcl
Example: Configuring an interface event monitor policy from the CLI
Configuration restrictions and guidelines
Introduction
This document provides EAA configuration examples to show you how to configure an interface event monitor policy by using Tcl or CLI.
Prerequisites
This document is not restricted to specific software or hardware versions.
The configuration examples in this document were created and verified in a lab environment, and all the devices were started with the factory default configuration. When you are working on a live network, make sure you understand the potential impact of every command on your network.
This document assumes that you have basic knowledge of EAA.
Example: Configuring an interface event monitor policy by using Tcl
Network requirements
Configure a monitor policy to monitor the incoming traffic statistic on GigabitEthernet 3/0/1.
Trigger the policy when the following events occur:
· The traffic statistic reaches or exceeds the start threshold (500000000 bps) for the first time.
· The traffic statistic reaches or exceeds the start threshold each time after it reaches or exceeds the restart threshold (200000000 bps).
Configure the policy to execute the following actions when it is triggered:
· Sends the message "GE3/0/1 input rate exceeded 500000000bps" with a priority of 1 from the logging facility local1.
· Displays the current CPU usage statistics, and saves the statistics to the file ge0_info.txt.
· Displays information about GigabitEthernet 3/0/1, and saves the information to the file ge0_info.txt.
Software version used
This configuration example was created and verified on S7500E-CMW710-R7150.
Configuration procedures
Editing a Tcl script file
# Configure the policy to monitor the incoming traffic on GigabitEthernet 3/0/1. Set the start and restart thresholds (in bps) to 500000000 and 200000000, respectively.
::comware::rtm::event_register interface gigabitethernet3/0/1 monitor-obj rcv-bps start-op ge start-val 500000000 restart-op ge restart-val 200000000 user-role network-admin
# Add an action that sends the message "GE3/0/1 input rate exceeded 500000000bps" with a priority of 1 from the logging facility local1.
::comware::rtm::action syslog priority 1 facility local1 msg "GE3/0/1 input rate exceeded 500000000bps"
# Enable the action.
::comware::create-cli
# Add an action that displays the current CPU usage statistics and saves the statistics to the file ge0_info.txt.
::comware::write-cli cli0 "display cpu-usage >> ge0_info.txt"
# Add an action that displays information about GigabitEthernet 3/0/1 and saves the information to the file ge0_info.txt.
::comware::write-cli cli0 "display interface gigabitethernet3/0/1 >> ge0_info.txt"
::comware::write-cli cli0 "end"
Configuring the device
# Assign an IP address to GigabitEthernet 3/0/1.
<Device> system-view
[Device] interface gigabitethernet 3/0/1
[Device-GigabitEthernet3/0/1] ip address 192.168.100.66 255.255.255.0
[Device-GigabitEthernet3/0/1] quit
[Device] quit
# Download the Tcl script file test.tcl from the TFTP server at 192.168.100.14.
<Device> tftp 192.168.100.14 get test.tcl
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 189 100 189 0 0 7900 0 --:--:-- --:--:-- --:--:-- 12600
# Create the Tcl-defined policy test and bind it to the Tcl script file. In this example, the script file name is test.tcl.
<Device> system-view
[Device] rtm tcl-policy test test.tcl
[Device] quit
Verifying the configuration
# Display information about the policy.
<Device> display rtm policy registered
Total number: 1
Type Event TimeRegistered PolicyName
TCL INTERFACE Oct 22 14:06:20 2014 test
# Verify that ge0_info.txt was created.
<Device> dir
Directory of cfa0:
0 -rw- 3227 Nov 19 2013 17:28:36 1.cfg
1 -rw- 2296 Apr 26 2013 18:55:08 5660_data.ak
2 -rw- 2304 Apr 26 2013 18:54:56 5660_security.ak
3 -rw- 2298 Apr 26 2013 18:55:16 5660_voice.ak
4 -rw- 3227 Nov 19 2013 17:15:19 STARTUP110.CFG
5 drw- - Mar 10 2013 04:10:10 diagfile
6 -rw- 567 Jul 17 2013 14:25:00 dsakey
7 -rw- 223 Jul 17 2013 14:25:00 ecdsakey
8 -rw- 278 Jul 17 2013 14:25:00 ge0_info.txt
9 -rw- 735 Jul 17 2013 14:25:00 hostkey
10 -rw- 492 Nov 18 2013 16:40:50 ifindex.dat
11 -rw- 276 Apr 23 2013 19:00:00 lauth.dat
12 drw- - Jul 17 2013 11:26:34 license
13 drw- - Apr 24 2013 12:39:38 logfile
14 -rw- 18839552 Nov 14 2013 16:42:12 msr56-cmw710-boot-r000706.bin
15 -rw- 1150976 Nov 14 2013 16:43:00 msr56-cmw710-data-r000706.bin
16 -rw- 47470592 Nov 14 2013 16:42:24 msr56-cmw710-system-r000706.bin
17 -rw- 2975744 Nov 14 2013 16:42:56 msr56-cmw710-voice-r000706.bin
18 -rw- 70445056 Nov 14 2013 17:41:08 msr56.ipe
19 -rw- 70445056 Nov 14 2013 16:40:00 msr56NN.ipe
20 drw- - Aug 21 2013 16:23:10 pkey
21 -rw- 189 Nov 19 2013 17:49:34 test.tcl
22 drw- - Mar 10 2013 04:10:10 seclog
23 -rw- 591 Jul 17 2013 14:25:00 serverkey
24 -rw- 3227 Nov 18 2013 16:40:50 startup.cfg
507492 KB total (298412 KB free)
# Upload ge0_info.txt to the TFTP server at 192.168.100.14.
<Device> tftp 192.168.100.14 put ge0_info.txt
# Verify that ge0_info.txt contains the CPU usage statistics and information about GigabitEthernet 3/0/1.
Slot 3 CPU 0 CPU usage:
5% in last 5 seconds
5% in last 1 minute
6% in last 5 minutes
Slot 7 CPU 0 CPU usage:
1% in last 5 seconds
1% in last 1 minute
1% in last 5 minutes
GigabitEthernet3/0/1
Current state: UP
Line protocol state: UP
Description: GigabitEthernet3/0/1 Interface
Bandwidth: 1000000kbps
Maximum Transmit Unit: 1500
Internet protocol processing: disabled
IP Packet Frame Type:PKTFMT_ETHNT_2, Hardware Address: 4431-9255-f3fc
IPv6 Packet Frame Type:PKTFMT_ETHNT_2, Hardware Address: 4431-9255-f3fc
Media type is twisted pair
Port hardware type is 1000_BASE_T
Port priority: 0
1000Mbps-speed mode, full-duplex mode
Link speed type is autonegotiation, link duplex type is autonegotiation
Flow-control is not enabled
The Maximum Frame Length is 9216
Last clearing of counters: Never
Peak value of input: 108106680 bytes/sec, at 2014-10-15 14:14:30
Peak value of output: 20 bytes/sec, at 2014-10-15 13:24:25
Last 300 seconds input: 1028465 packets/sec 65821768 bytes/sec 69%
Last 300 seconds output: 0 packets/sec 9 bytes/sec 0%
Input (total): 9585460958 packets, 759947089836 bytes
9585460803 unicasts, 3 broadcasts, 9 multicasts, 0 pauses
Input (normal): 9585460815 packets, - bytes
9585460803 unicasts, 3 broadcasts, 9 multicasts, 0 pauses
Input: 1 input errors, 0 runts, 0 giants, 0 throttles
1 CRC, 0 frame, - overruns, 0 aborts
- ignored, - parity errors
Output (total): 313 packets, 94288 bytes
0 unicasts, 0 broadcasts, 313 multicasts, 0 pauses
Output (normal): 313 packets, - bytes
0 unicasts, 0 broadcasts, 313 multicasts, 0 pauses
Output: 0 output errors, - underruns, - buffer failures
0 aborts, 0 deferred, 0 collisions, 0 late collisions
0 lost carrier, - no carrier
Configuration files
· Tcl script file:
::comware::rtm::event_register interface gigabitethernet3/0/1 monitor-obj rcv-bps start-op ge start-val 500000000 restart-op ge restart-val 200000000 user-role network-admin
::comware::rtm::action syslog priority 1 facility local1 msg "GE3/0/1 input rate exceeded 500000000bps"
::comware::create-cli
::comware::write-cli cli0 "display cpu-usage >> ge0_info.txt"
::comware::write-cli cli0 "display interface gigabitethernet3/0/1 >> ge0_info.txt"
::comware::write-cli cli0 "end"
· Device:
#
interface GigabitEthernet3/0/1
port link-mode route
ip address 192.168.100.66 255.255.255.0
#
rtm tcl-policy test test.tcl
#
Example: Configuring an interface event monitor policy from the CLI
Network requirements
Configure a monitor policy to monitor the incoming traffic statistic on GigabitEthernet 3/0/1.
Trigger the policy when the following events occur:
· The traffic statistic reaches or exceeds the start threshold (500000000 bps) for the first time.
· The traffic statistic reaches or exceeds the start threshold each time after it reaches or exceeds the restart threshold (200000000 bps).
Configure the policy to execute the following actions when it is triggered:
· Sends the message "GE3/0/1 input rate exceeded 500000000bps" with a priority of 1 from the logging facility local1.
· Displays the current CPU usage statistics, and saves the statistics to the file ge0_info.txt.
· Displays information about GigabitEthernet 3/0/1, and saves the information to the file ge0_info.txt.
To conserve system resources, limit the policy runtime to 30 seconds. When the runtime is reached, the system stops executing the policy even if the execution is not finished.
Software version used
This configuration example was created and verified on S7500E-CMW710-R7150.
Configuration restrictions and guidelines
When you configure a CLI-defined policy, follow these restrictions and guidelines:
· A monitor policy can contain only one event and one runtime setting. If the monitor policy already contains an event or runtime setting, the new setting replaces the old setting.
· A new action overwrites the previous action with the same ID.
· You must execute the commit command for a CLI-defined policy to take effect. After changing the settings (such as the event, runtime, CLI action, and user role configurations) in the policy, you must re-execute this command for the changes to take effect.
· For EAA to execute an action in a monitor policy, you must assign the policy the user role that has access to the action-specific commands and resources. If EAA lacks access to an action-specific command or resource, EAA does not perform the action and all the subsequent actions.
· You cannot assign a monitor policy user roles that have higher privilege than the user roles you are logged in with.
Configuration procedures
# Assign an IP address to GigabitEthernet 3/0/1.
<Device> system-view
[Device] interface gigabitethernet 3/0/1
[Device-GigabitEthernet3/0/1] ip address 192.168.100.66 255.255.255.0
[Device-GigabitEthernet3/0/1] quit
# Create the CLI-defined policy 1 and enter its view.
[Device] rtm cli-policy 1
# Configure the policy to monitor the incoming traffic on GigabitEthernet 3/0/1. Set the start and restart thresholds (in bps) to 500000000 and 200000000, respectively.
[Device-rtm-1] event interface gigabitEthernet 3/0/1 monitor-obj rcv-bps start-op ge
start-val 500000000 restart-op ge restart-val 200000000
# Add an action that sends the message "GE3/0/1 input rate exceeded 500000000bps" with a priority of 1 from the logging facility local1.
[Device-rtm-1] action 1 syslog priority 1 facility local1 msg "GE3/0/1 input rate exceeded 500000000bps"
# Add an action that displays the current CPU usage statistics and saves the statistics to the file ge0_info.txt.
[Device-rtm-1] action 2 cli display cpu-usage >> ge0_info.txt
# Add an action that displays information about GigabitEthernet 3/0/1, and saves the information to the file ge0_info.txt.
[Device-rtm-1] action 3 cli display interface gigabitethernet 3/0/1 >> ge0_info.txt
# Set the policy runtime to 30 seconds.
[Device-rtm-1] running-time 30
# Specify the network-admin user role for executing the policy.
[Device-rtm-1] user-role network-admin
# Enable the policy.
[Device-rtm-1] commit
[Device-rtm-1] quit
Verifying the configuration
# Display information about the policy.
<Device> display rtm policy registered
Total number: 1
Type Event TimeRegistered PolicyName
CLI INTERFACE May 04 00:12:40 2014 1
# Verify that ge0_info.txt was created.
<Device> dir
Directory of cfa0:
0 -rw- 3227 Nov 19 2013 17:28:36 1.cfg
1 -rw- 2296 Apr 26 2013 18:55:08 5660_data.ak
2 -rw- 2304 Apr 26 2013 18:54:56 5660_security.ak
3 -rw- 2298 Apr 26 2013 18:55:16 5660_voice.ak
4 -rw- 3227 Nov 19 2013 17:15:19 STARTUP110.CFG
5 drw- - Mar 10 2013 04:10:10 diagfile
6 -rw- 567 Jul 17 2013 14:25:00 dsakey
7 -rw- 223 Jul 17 2013 14:25:00 ecdsakey
8 -rw- 278 Jul 17 2013 14:25:00 ge0_info.txt
9 -rw- 735 Jul 17 2013 14:25:00 hostkey
10 -rw- 492 Nov 18 2013 16:40:50 ifindex.dat
11 -rw- 276 Apr 23 2013 19:00:00 lauth.dat
12 drw- - Jul 17 2013 11:26:34 license
13 drw- - Apr 24 2013 12:39:38 logfile
14 -rw- 18839552 Nov 14 2013 16:42:12 msr56-cmw710-boot-r000706.bin
15 -rw- 1150976 Nov 14 2013 16:43:00 msr56-cmw710-data-r000706.bin
16 -rw- 47470592 Nov 14 2013 16:42:24 msr56-cmw710-system-r000706.bin
17 -rw- 2975744 Nov 14 2013 16:42:56 msr56-cmw710-voice-r000706.bin
18 -rw- 70445056 Nov 14 2013 17:41:08 msr56.ipe
19 -rw- 70445056 Nov 14 2013 16:40:00 msr56NN.ipe
20 drw- - Aug 21 2013 16:23:10 pkey
21 -rw- 189 Nov 19 2013 17:49:34 test.tcl
22 drw- - Mar 10 2013 04:10:10 seclog
23 -rw- 591 Jul 17 2013 14:25:00 serverkey
24 -rw- 3227 Nov 18 2013 16:40:50 startup.cfg
507492 KB total (298412 KB free)
# Upload ge0_info.txt to the TFTP server at 192.168.100.14.
<Device> tftp 192.168.100.14 put ge0_info.txt
# Verify that ge0_info.txt contains the current CPU usage statistics and information about GigabitEthernet 3/0/1.
Slot 3 CPU 0 CPU usage:
5% in last 5 seconds
5% in last 1 minute
6% in last 5 minutes
Slot 7 CPU 0 CPU usage:
1% in last 5 seconds
1% in last 1 minute
1% in last 5 minutes
GigabitEthernet3/0/1
Current state: UP
Line protocol state: UP
Description: GigabitEthernet3/0/1 Interface
Bandwidth: 1000000kbps
Maximum Transmit Unit: 1500
Internet protocol processing: disabled
IP Packet Frame Type:PKTFMT_ETHNT_2, Hardware Address: 4431-9255-f3fc
IPv6 Packet Frame Type:PKTFMT_ETHNT_2, Hardware Address: 4431-9255-f3fc
Media type is twisted pair
Port hardware type is 1000_BASE_T
Port priority: 0
1000Mbps-speed mode, full-duplex mode
Link speed type is autonegotiation, link duplex type is autonegotiation
Flow-control is not enabled
The Maximum Frame Length is 9216
Last clearing of counters: Never
Peak value of input: 108106680 bytes/sec, at 2014-10-15 14:14:30
Peak value of output: 20 bytes/sec, at 2014-10-15 13:24:25
Last 300 seconds input: 1028465 packets/sec 65821768 bytes/sec 69%
Last 300 seconds output: 0 packets/sec 9 bytes/sec 0%
Input (total): 9585460958 packets, 759947089836 bytes
9585460803 unicasts, 3 broadcasts, 9 multicasts, 0 pauses
Input (normal): 9585460815 packets, - bytes
9585460803 unicasts, 3 broadcasts, 9 multicasts, 0 pauses
Input: 1 input errors, 0 runts, 0 giants, 0 throttles
1 CRC, 0 frame, - overruns, 0 aborts
- ignored, - parity errors
Output (total): 313 packets, 94288 bytes
0 unicasts, 0 broadcasts, 313 multicasts, 0 pauses
Output (normal): 313 packets, - bytes
0 unicasts, 0 broadcasts, 313 multicasts, 0 pauses
Output: 0 output errors, - underruns, - buffer failures
0 aborts, 0 deferred, 0 collisions, 0 late collisions
0 lost carrier, - no carrier
Configuration files
#
interface GigabitEthernet3/0/1
port link-mode route
ip address 192.168.100.66 255.255.255.0
#
rtm cli-policy 1
event interface GigabitEthernet3/0/1 monitor-obj rcv-bps start-op ge start-val 500000000 restart-op ge restart-val 200000000
action 1 syslog priority 1 facility local1 msg "GE3/0/1 input rate exceeded 500000000bps"
action 2 cli display cpu-usage >> ge0_info.txt
action 3 cli display interface gigabitethernet 3/0/1 >> ge0_info.txt
running-time 30
user-role network-admin
#
Related documentation
· H3C S7500E Switch Series Network Management and Monitoring Configuration Guide-Release 7150
· H3C S7500E Switch Series Network Management and Monitoring Command Reference-Release 7150