如何屏蔽SNMP告警
如何在交换机上屏蔽某一条或者某一类告警
这种场景下,通过开关控制交换机上的告警是否产生,如果某个告警对应的开关被关闭,则交换机本地就不会再继续产生告警,更不会发送到网管上。
在默认情况下部分告警模块处于打开状态,部分告警模块处于关闭状态,可以通过display snmp-agent trap all命令查看所有告警模块的开关状态。举例如下:
<HUAWEI> display snmp-agent trap all ------------------------------------------------------------------------------ Feature name: INFO Trap number : 2 ------------------------------------------------------------------------------ Trap name Default switch status Current switch status hwICLogFileAging on on hwICLogBufferLose on on ------------------------------------------------------------------------------ ---- More ----
项目 |
描述 |
---|---|
Feature name |
产生告警的特性名称。 |
Trap number |
该特性下包含的告警数量。 |
Trap name |
告警名称。 |
Default switch status |
告警开关的缺省状态:
|
Current switch status |
告警开关的当前状态:
该状态可通过命令snmp-agent trap enable feature-name配置。 |
如果用户希望关闭某条告警,或者关闭某个模块的告警,可以按照如下步骤进行配置。
- 查询交换机告警参考,通过关键字搜索找到对应的告警,例如用户想屏蔽光模块相关的告警一系列告警,告警标题如下:
ENTITYTRAP_1.3.6.1.4.1.2011.5.25.219.2.4.5 hwOpticalInvalid 136xxx //会存在这样的一系列告警。
从这条告警的标题中找到两个关键参数:
- ENTITYTRAP:是产生告警的特性名称。
- hwOpticalInvalid:是告警名称
- 使用snmp-agent trap enable命令或者snmp-agent trap enable feature-name feature-name trap-name trap-name设置告警的开关状态。
参数
参数说明
feature-name
指定产生告警的特性名称。
trap-name
指定告警名称。
在本例中,用户想屏蔽光模块相关的告警,则执行如下命即可:
undo snmp-agent trap enable feature-name ENTITYTRAP trap-name hwOpticalInvalid
如何将特定的告警发送到指定的主机上
这种场景下,交换机本地仍然可以正常产生告警,还是在发往网管主机上的时候会设置一层过滤,只能部分满足特定规则的告警可以发送至网管主机。
现网中,客户有时候会需要将特定的告警发送到特定的主机上。例如客户建立了一个专用的网管,用于监控网络设备的链路UP和DOWN状态,不希望收到其他的告警。交换机支持通过snmp-agent notify-filter-profile命令来实现该需求。这类需求一般包括两类场景:
- 场景一:需要上报某些告警,其他的都不需要上报。
- 场景二:排除某些告警,其他的告警都需要上报。
场景一配置举例:客户希望将链路UP和DOWN状态的告警上报给IP地址为10.8.8.8的指定的网管,同时不希望将其他的告警上给网管。
- 在产品文档的MIB参考中查询到这两个告警的详细描述,如下表所示。
OID
节点名称
绑定变量
含义
实现规格
1.3.6.1.6.3.1.1.5.4
linkUp
- ifIndex
- ifAdminStatus
- ifOperStatus
- ifDesc
linkUp告警表示:作为代理的SNMP实体已经检测到由于ifOperStatus节点中的其中一条通信链路已经从Down状态转变为其他状态(但不是notPresent状态)。这里的其他状态由ifOperStatus的值显示
实现与MIB文件定义一致。
OID
节点名称
绑定变量
含义
实现规格
1.3.6.1.6.3.1.1.5.3
linkDown
- ifIndex
- ifAdminStatus
- ifOperStatus
- ifDesc
linkDown告警表示:作为代理的SNMP实体已经检测到由于ifOperStatus节点中的其中一条通信链路已经从其他状态(但不是notPresent状态)进入Down状态。这里的其他状态由ifOperStatus的值显示。
实现与MIB文件定义一致。
- 通过snmp-agent notify-filter-profile命令配置告警过滤模板,包含linkUp和linkDown的告警节点。此处假设告警过滤模板名称为profile_a。
snmp-agent notify-filter-profile included profile_a linkUp snmp-agent notify-filter-profile included profile_a linkDown
- 需要注意,对特定告警进行include过滤时,除了包含此告警节点本身以外,还必须包含此告警的所有绑定变量,否则,告警过滤不成功。因此还需要将linkUp、linkDown的告警的所有绑定变量也包含进来,详细配置如下。
snmp-agent notify-filter-profile included profile_a ifIndex snmp-agent notify-filter-profile included profile_a ifDesc snmp-agent notify-filter-profile included profile_a ifAdminStatus snmp-agent notify-filter-profile included profile_a ifOperStatus
- 需要注意,由于SNMPv2c和SNMPv3的trap报文中还包括sysUpTime、snmpTrapOID节点,因此还需要将这两个节点也包含进来,详细配置如下。
snmp-agent notify-filter-profile included profile_a sysUpTime snmp-agent notify-filter-profile included profile_a snmpTrapOID
- 上述配置完成以后,配置告警主机的IP地址,同时关联告警过滤模板。
snmp-agent target-host trap address udp-domain 10.8.8.8 params securityname cipher @%@%m%eiQi2Kz+-/Z:!gz24-a4IY@%@% v2c notify-filter-profile profile_a
场景二配置举例:客户希望将除linkUp、linkDown的告警之外的告警上报给网管。
针对这类场景,需要注意如下两点:
- 用exclude排除某类告警的时候,最后要通过included包含iso节点,否则所有告警都收不到。
- 对特定告警进行exclude过滤时,只须包含此告警的OID或者任一绑定变量的OID即可。
详细配置如下:
- 通过snmp-agent notify-filter-profile命令配置告警过滤模板,排除linkUp和linkDown的告警节点,包含其他的所有节点。此处假设告警过滤模板名称为profile_a。
snmp-agent notify-filter-profile exclude profile_a linkUp snmp-agent notify-filter-profile exclude profile_a linkDown snmp-agent notify-filter-profile include profile_a iso
- 上述配置完成以后,配置告警主机的IP地址,同时关联告警过滤模板。
snmp-agent target-host trap address udp-domain 8.8.8.8 params securityname cipher @%@%m%eiQi2Kz+-/Z:!gz24-a4IY@%@% v2c notify-filter-profile profile_a