华为交换机SNMP配置

 

配置设备发送告警和错误码的目的IP地址时,请根据需要选择配置Trap方式告警或Inform方式告警:

  • 被管理设备发送Trap方式告警时,不需要网管回应确认信息。

  • 被管理设备发送Inform方式告警时,需要网管回应确认消息,在超时时间范围内没有收到网管的回应消息时,被管理设备将重新发送该告警,直至发送的告警个数达到配置的重复发送最大次数。

  • 被管理设备发送Inform告警时,同时记录告警日志,方便网管故障或链路故障恢复后,网管能够同步故障时间内产生的告警。

因此,Inform告警相比Trap方式告警更加可靠,但由于重传机制的存在,可能导致设备需要缓存大量的告警信息,占用设备内存资源。建议用户在网络比较稳定时选择Trap方式告警;在设备资源充足且网络不太稳定的环境下,选择配置Inform方式告警。

 

  • 配置设备发送Trap告警和错误码的目的IP地址,请执行命令:

    snmp-agent target-host trap address udp-domain ip-address [ udp-port port-number | source interface-type interface-number | [ public-net | vpn-instance vpn-instance-name ] ] * params securityname { security-name | cipher security-name } [ v2c | private-netmanager | notify-filter-profile profile-name | ext-vb ] *

  • 配置设备发送Inform告警和错误码的目的IP地址,请执行命令:

    snmp-agent target-host inform address udp-domain ip-address [ udp-port port-number | source interface-type interface-number | [ vpn-instance vpn-instance-name | public-net ] ]* params securityname { security-name | cipher security-name } v2c [ notify-filter-profile profile-name | ext-vb ] *

例子:

  

snmp-agent                       /使能snmp服务/
snmp-agent local-engineid 000007DB7F000001000049DD   /系统自动生成,无需配置/
snmp-agent community read public            /设置读团体名:public/
snmp-agent community write private           /设置写团体名:private/
snmp-agent sys-info contact Mr.Deng-Tel:161     /设置联系方式/
snmp-agent sys-info location sjhl-3f-a1-k01-12U       /设置设备位置/
snmp-agent sys-info version v1 v3            /配置snmp版本允许V1(默认只允许v3)/ 

snmp-agent target-host trap address udp-domain 10.1.1.2  params securityname public

/允许向网管工作站(NMS)10.1.1.2 发送Trap报文,使用的团体名为public/

snmp-agent target-host inform address udp-domain 10.1.1.2 params securityname public v2c

/允许向网管工作站(NMS)10.1.1.2 发送inform报文,使用的团体名为public/


验证配置结果

配置完成后,可以执行下面的命令,检查配置内容是否生效。

# 查看SNMP版本。

[Switch] display snmp-agent sys-info version
   SNMP version running in the system:                                          
           SNMPv2c SNMPv3  

# 查看告警的目标主机。

display snmp-agent target-host
Target host NO. 1
---------------------------------------------------------------------------
Host name :
IP address : 10.1.1.2
Source interface : -
VPN instance : -
Security name : %^%#`cZ&83<QE3$,+&(6w^\*hLVz65
Port : 162
Type : inform
Version : v2c
Level : No authentication and privacy
NMS type : NMS
With ext vb : No
Notification filter profile name : -
Heart beat required : No
---------------------------------------------------------------------

 
 
posted @ 2021-03-31 10:39  dgdyq  阅读(4161)  评论(0编辑  收藏  举报