04-H3C_S12500-S_EAA典型配置举例
本章节下载: 04-H3C_S12500-S_EAA典型配置举例 (144.91 KB)
H3C S12500-S EAA典型配置举例
Copyright © 2015 杭州华三通信技术有限公司 版权所有,保留一切权利。 非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部, 并不得以任何形式传播。本文档中的信息可能变动,恕不另行通知。 |
目 录
本文档介绍使用EAA的典型配置举例。
本文档不严格与具体软、硬件版本对应,如果使用过程中与产品实际情况有差异,请参考相关产品手册,或以设备实际情况为准。
本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。
本文档假设您已了解EAA特性,对于同一需求,Tcl和CLI监控策略的实现效果是一致的,用户可以根据习惯选择任意一种策略。
为设备配置Tcl监控策略,当检测接口GigabitEthernet1/0/1入流量值大于等于500Mbps时,执行如下操作:
· 生成流量超范围的日志。
· 显示当前cpu状态,并保存至文件。
· 显示接口GigabitEthernet1/0/1状态,并保存至文件。
如果后续入流量大于等于200Mbps时会再次启动监控,当再次检测到接口入流量大于500Mbps时,执行上述操作。
本举例是在S12500-S-CMW710-R7150P02版本上进行配置和验证的。
# 使用写字板编辑文件test.tcl,如下:
# 定义监控事件,监控接口为GigabitEthernet1/0/1,关注入方向流量,当入流量大于等于500Mbps时,执行动作;再次开启轮询的条件为接口流量大于等于200Mbps。
::comware::rtm::event_register interface gigabitethernet1/0/1 monitor-obj rcv-bps start-op ge start-val 500000000 restart-op ge restart-val 200000000 user-role network-admin
# 当监控事件发生时执行动作为:发送优先级为1、设备号为local1、信息为GE1/0/1 input rate exceeded 500000000bps的日志。
::comware::rtm::action syslog priority 1 facility local1 msg "GE1/0/1 input rate exceeded 500000000bps"
# 创建监控事件的执行动作。
::comware::create-cli
# 当监控事件发生时执行动作为:执行display cpu-usage命令,显示CPU利用率的统计信息,并将信息保存在文件ge0_info.txt中。
::comware::write-cli cli0 "display cpu-usage >> ge0_info.txt"
# 当监控事件发生时执行动作为:执行display interface gigabitetherne 1/0/1命令,显示GigabitEthernet1/0/1当前的运行状态和相关信息,并将信息保存在文件ge0_info.txt中。
::comware::write-cli cli0 "display interface gigabitethernet1/0/1 >> ge0_info.txt"
::comware::write-cli cli0 "end"
# 配置接口GigabitEthernet1/0/1的IP地址。
<Device> system-view
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] ip address 192.168.100.66 255.255.255.0
[Device-GigabitEthernet1/0/1] quit
[Device] quit
# 通过TFTP将test.tcl下载到设备上。
<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
# 创建并启用Tcl监控策略,并将其和Tcl脚本test.tcl绑定。
<Device> system-view
[Device] rtm tcl-policy test test.tcl
[Device] quit
# 通过display rtm policy registered命令可以看到存在策略名为test,策略类型为Tcl的策略。
<Device> display rtm policy registered
Total number: 1
PolicyName Type Event TimeRegistered User-role
test TCL INTERFACE May 05 06:46:20 2014 network-admin
# 当检测到接口GigabitEthernet1/0/1入流量值大于等于500Mbps时,查看设备中所有的文件及文件夹信息,存在ge0_info.txt。
<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)
# 使用TFTP方式,将ge0_info.txt文件复制到TFTP服务器上。
<Device> tftp 192.168.100.14 put ge0_info.txt
# 查看ge0_info.txt文件,显示包含当前CPU和接口GigabitEthernet1/0/1状态。
Unit CPU usage:
15% in last 5 seconds
14% in last 1 minute
13% in last 5 minutes
GigabitEthernet1/0/1
Current state: UP
Line protocol state: UP
Description: GigabitEthernet1/0/1 Interface
Bandwidth: 1000000kbps
Maximum Transmit Unit: 1500
Internet Address is 192.168.100.66/24 Primary
IP Packet Frame Type:PKTFMT_ETHNT_2, Hardware Address: 0cda-41b2-1e32
IPv6 Packet Frame Type:PKTFMT_ETHNT_2, Hardware Address: 0cda-41b2-1e32
Media type: twisted pair, loopback: not set, promiscuous mode: not set
1000Mb/s, Full-duplex, link type: autonegotiation
flow-control: disabled
Output queue - Urgent queuing: Size/Length/Discards 0/100/0
Output queue - Protocol queuing: Size/Length/Discards 0/500/0
Output queue - FIFO queuing: Size/Length/Discards 0/75/0
Last clearing of counters: Never
Last 300 seconds input rate: 568710000.25 bytes/sec, 64970 bits/sec, 4.96 packets/sec
Last 300 seconds output rate: 568710000.25 bytes/sec, 64970 bits/sec, 4.96 packets/sec
Input:
1703 packets, 2336882000 bytes
2 broadcasts, 0 multicasts, 0 pauses
0 errors, 0 runts, 0 giants
0 CRC, 0 overruns
0 drops, 0 no buffers
Output:
1706 packets, 2337062000 bytes
7 broadcasts, 0 multicasts, 0 pauses
0 errors, 0 underruns, 0 collisions
0 deferred, 0 lost carriers
· test.tcl脚本文本:
::comware::rtm::event_register interface gigabitethernet1/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 "GE1/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 gigabitethernet1/0/1 >> ge0_info.txt"
::comware::write-cli cli0 "end"
· Device:
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 192.168.100.66 255.255.255.0
#
rtm tcl-policy test test.tcl
#
为设备配置Tcl监控策略,当检测接口GigabitEthernet1/0/1入流量值大于等于500Mbps时,执行如下操作:
· 生成流量超范围的日志。
· 显示当前cpu状态,并保存至文件。
· 显示接口GigabitEthernet1/0/1状态,并保存至文件。
如果后续入流量大于等于200Mbps时会再次启动监控,当再次检测到接口入流量大于500Mbps时,执行上述操作。
本举例是在S12500-S-CMW710-R7150P02版本上进行配置和验证的。
· 同一个策略下,只能配置一个触发事件和运行时间。当多次执行event或者running-time命令时,则最近配置并且commit的生效。
· 如果新配置的动作的编号和已有动作的编号相同,则执行commit命令后最近配置生效。
· 给CLI监控策略配置事件、动作、用户角色和运行时间后,必须执行commit命令,该策略才会启用,该策略下的配置才会生效。
# 配置接口GigabitEthernet1/0/1的IP地址。
<Device> system-view
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] ip address 192.168.100.66 255.255.255.0
[Device-GigabitEthernet1/0/1] quit
# 创建CLI策略1。
[Device] rtm cli-policy 1
# 配置监控事件,监控接口为GigabitEthernet1/0/1,当入流量大于等于500Mbps时执行动作;再次开启轮询的条件为接口流量大于等于200Mbps。
[Device-rtm-1] event interface gigabitEthernet 1/0/1 monitor-obj rcv-bps start-op ge start-val 500000000 restart-op ge restart-val 200000000
# 当事件发生时,发送优先级为1、日志记录工具为local1、信息为GE1/0/1 input rate exceeded 500000000bps的日志。
[Device-rtm-1] action 1 syslog priority 1 facility local1 msg "GE1/0/1 input rate exceeded 500000000bps"
# 当事件发生时,执行display cpu-usage命令,显示CPU利用率的统计信息,并将信息保存在文件ge0_info.txt中。
[Device-rtm-1] action 2 cli display cpu-usage >> ge0_info.txt
# 当事件发生时,执行display interface gigabitetherne 1/0/1命令,显示GigabitEthernet1/0/1当前的运行状态和相关信息,并将信息保存在文件ge0_info.txt中。
[Device-rtm-1] action 3 cli display interface gigabitethernet 1/0/1 >> ge0_info.txt
# 配置策略运行时间为30s。
[Device-rtm-1] running-time 30
# 配置执行CLI监控策略1时使用的用户角色为network-admin。
[Device-rtm-1] user-role network-admin
# 启用CLI监控策略1。
[Device-rtm-1] commit
[Device-rtm-1] quit
# 通过display rtm policy registered命令查看,可以看到策略名为1,策略类型为CLI的策略。
<Device> display rtm policy registered
Total number: 1
PolicyName Type Event TimeRegistered User-role
1 CLI INTERFACE May 04 00:12:40 2014 network-admin
# 当检测到接口GigabitEthernet1/0/1入流量值大于等于500Mbps时,查看设备中所有的文件及文件夹信息,存在ge0_info.txt。
<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)
# 使用TFTP方式,将ge0_info.txt文件复制到TFTP服务器上。
<Device> tftp 192.168.100.14 put ge0_info.txt
# 查看ge0_info.txt文件,显示包含当前CPU和接口GigabitEthernet1/0/1状态。
Unit CPU usage:
15% in last 5 seconds
14% in last 1 minute
13% in last 5 minutes
GigabitEthernet1/0/1
Current state: UP
Line protocol state: UP
Description: GigabitEthernet1/0/1 Interface
Bandwidth: 1000000kbps
Maximum Transmit Unit: 1500
Internet Address is 192.168.100.66/24 Primary
IP Packet Frame Type:PKTFMT_ETHNT_2, Hardware Address: 0cda-41b2-1e32
IPv6 Packet Frame Type:PKTFMT_ETHNT_2, Hardware Address: 0cda-41b2-1e32
Media type: twisted pair, loopback: not set, promiscuous mode: not set
1000Mb/s, Full-duplex, link type: autonegotiation
flow-control: disabled
Output queue - Urgent queuing: Size/Length/Discards 0/100/0
Output queue - Protocol queuing: Size/Length/Discards 0/500/0
Output queue - FIFO queuing: Size/Length/Discards 0/75/0
Last clearing of counters: Never
Last 300 seconds input rate: 568710000.25 bytes/sec, 64970 bits/sec, 4.96 packets/sec
Last 300 seconds output rate: 568710000.25 bytes/sec, 64970 bits/sec, 4.96 packets/sec
Input:
1703 packets, 2336882000 bytes
2 broadcasts, 0 multicasts, 0 pauses
0 errors, 0 runts, 0 giants
0 CRC, 0 overruns
0 drops, 0 no buffers
Output:
1706 packets, 2337062000 bytes
7 broadcasts, 0 multicasts, 0 pauses
0 errors, 0 underruns, 0 collisions
0 deferred, 0 lost carriers
#
interface GigabitEthernet1/0/1
port link-mode route
ip address 192.168.100.66 255.255.255.0
#
rtm cli-policy 1
event interface GigabitEthernet1/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 "GE1/0/1 input rate exceeded 500000000bps"
action 2 cli display cpu-usage >> ge0_info.txt
action 3 cli display interface gigabitethernet 1/0/1 >> ge0_info.txt
running-time 30
user-role network-admin
#
· H3C S12500-S系列以太网交换机 网络管理和监控配置指导-Release 7150P02
· H3C S12500-S系列以太网交换机 网络管理和监控命令参考-Release 7150P02
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!