华为交换机配置向SNMP Agent输出Trap信息
来自Linux78|wiki
SwitchA与网管站相连,SwitchA与网管站之间路由可达。网络管理员希望在网管站查看SwitchA产生的ARP模块的Trap信息,以便监控设备运行情况及定位故障信息。
使能信息中心功能。
配置向SNMP Agent输出Trap信息的信息通道和输出规则,以实现SwitchA产生的Trap信息发往SNMP代理方向。
配置Trap信息输出到网管站,以实现网络管理员能够在网管站接收SwitchA产生的Trap信息。
使能信息中心功能
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] info-center enable
配置向SNMP代理发送Trap信息的信息通道和输出规则
配置Trap信息输出到SNMP代理所使用的信息通道。
[SwitchA] info-center snmp channel channel7
配置向SNMP代理输出Trap信息的规则。
[ SwitchA] info-center source arp channel channel7 trap level informational state on
缺省情况下,设备通过SNMP Agent输出所有模块的Trap信息。
配置发送Trap信息接口的IP地址
[SwitchA] vlan batch 2 [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type trunk [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 [SwitchA-GigabitEthernet0/0/1] quit [SwitchA] interface vlanif 2 [SwitchA-Vlanif2] ip address 10.1.1.2 24 [SwitchA-Vlanif2] quit
配置SNMP Agent输出Trap信息到网管站
使能SNMP Agent,配置版本为SNMPv2c。
[SwitchA] snmp-agent sys-info version v2c
配置团体名。
[SwitchA] snmp-agent community write adminnms1
配置Trap功能。
[SwitchA] snmp-agent trap enable Warning: All switches of SNMP trap/notification will be open. Continue? [Y/N]:y [SwitchA] snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname public v2c [SwitchA] quit
验证配置结果
查看SNMP Agent输出信息所使用的通道。
<SwitchA> display info-center
Information Center:enabled
Log host:
Console:
channel number : 0, channel name : console
Monitor:
channel number : 1, channel name : monitor
SNMP Agent:
channel number : 7, channel name : channel7
Log buffer:
enabled,max buffer size 1024, current buffer size 512,
current messages 512, channel number : 4, channel name : logbuffer
dropped messages 0, overwritten messages 37
Trap buffer:
enabled,max buffer size 1024, current buffer size 256,
current messages 185, channel number:3, channel name:trapbuffer
dropped messages 0, overwritten messages 0
logfile:
channel number : 9, channel name : channel9, language : English
Information timestamp setting:
log - date, trap - date, debug - date millisecond
Sent messages = 273514, Received messages = 284905
IO Reg messages = 2 IO Sent messages = 11392
查看SNMP Agent所用通道输出的信息。
<SwitchA> display channel 7 channel number:7, channel name:channel7 MODU_ID NAME ENABLE LOG_LEVEL ENABLE TRAP_LEVEL ENABLE DEBUG_LEVEL ffff0000 default Y debugging Y debugging N debugging 416e0000 ARP Y debugging Y informational N debugging
查看SNMP Agent输出网管的信息。
<SwitchA> display snmp-agent target-host Target-host NO. 1 ----------------------------------------------------------- IP-address : 10.1.1.1 Domain : - Source interface : - VPN instance : - Security name : %^%#uq/!YZfvW4*vf[~C|.:Cl}UqS(vXd#wwqR~5M(rU%%^%# Port : 162 Type : trap Version : v2c Level : No authentication and privacy NMS type : NMS With ext-vb : No -----------------------------------------------------------
配置文件
SwitchA的配置文件
# sysname SwitchA # info-center source ARP channel 7 trap level informational info-center snmp channel 7 # vlan batch 2 # interface Vlanif2 ip address 10.1.1.2 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 2 # snmp-agent snmp-agent local-engineid 000007DB7FFFFFFF00003B4C snmp-agent community write cipher %^%#.T|&Whvyf$<Gd"I,wXi5SP_6~Nakk6<<+3H:N-h@aJ6d,l0md%HCeAY8~>X=>xV\JKNAL=124r839v<*%^%# snmp-agent sys-info version v2c v3 snmp-agent target-host trap address udp-domain 10.1.1.1 params securityname cipher %^%#uq/!YZfvW4*vf[~C|.:Cl}UqS(vXd#wwqR~5M(rU%%^%# v2c snmp-agent trap enable # return
