(抱歉,我把原文发到了错误的论坛)
我正在 Alma 9 上设置 Zabbix,在 SNMP 陷阱方面遇到了一个奇怪的问题。我们的 sip 交换机启用了 SNMP 并指向服务器,但出于某种原因 snmptrapd 不处理传入的陷阱
Zabbix 已安装并正在运行。snmp 和 trap 正在运行
[root@dev:~]$ ps ax | grep snmp
1472 ? S 0:00 /usr/sbin/zabbix_server: snmp trapper [processed data in 0.000060 sec, idle 1 sec]
1527 ? Sl 0:00 /usr/sbin/zabbix_server: snmp poller #1 [got 0 values, queued 0 in 5 sec, awaiting 0]
2174 ? Ss 0:00 /usr/sbin/snmptrapd -Lsd -f
2585 pts/1 S+ 0:00 grep --color=auto snmp
运行 snmptrapwalk 有效
snmptrap -v 2c -c public 10.5.5.122 '' SNMPv2-MIB::snmpMIB IF-MIB::linkDown s eth0
2025-01-10T16:51:09+0000 ZBXTRAP 10.5.5.122
PDU INFO:
receivedfrom UDP: [10.5.5.122]:47786->[10.5.5.122]:162
version 1
transactionid 2
requestid 1130383097
errorstatus 0
messageid 0
notificationtype TRAP
errorindex 0
community public
VARBINDS:
DISMAN-EVENT-MIB::sysUpTimeInstance type=67 value=Timeticks: (337607) 0:56:16.07
SNMPv2-MIB::snmpTrapOID.0 type=6 value=OID: SNMPv2-MIB::snmpMIB
IF-MIB::linkDown type=4 value=STRING: "eth0"
在我们的 SIP 交换机上,如果我重新启动其中一个模块,它会触发 snmpt trap。使用 TCP dump,我可以将其发送到 zabbix 服务器
tcpdump -i ens18 -T snmp -n dst portrange 161-162
17:14:35.573815 IP 10.7.7.113.33830 > 10.5.5.122.snmptrap: V2Trap(174) .1.3.6.1.2.1.1.3.0=1877147173 .1.3.6.1.6.3.1.1.4.1.0=.1.3.6.1.4.1.17236.2.1 .1.3.6.1.4.1.17236.1.1="CRITICAL : 003 010008 000007 10/01/2025 17:14:35 : Connection to 0XA070771 (SIP Switch 3 - BT) lost"
17:14:36.427854 IP 10.7.7.113.43173 > 10.5.5.122.snmptrap: V2Trap(152) .1.3.6.1.2.1.1.3.0=1877147258 .1.3.6.1.6.3.1.1.4.1.0=.1.3.6.1.4.1.17236.2.1 .1.3.6.1.4.1.17236.1.1="CRITICAL : 003 010000 000000 10/01/2025 17:14:36 : Application Server stopped"
17:14:37.434487 IP 10.7.7.113.54710 > 10.5.5.122.snmptrap: V2Trap(222) .1.3.6.1.2.1.1.3.0=1877147359 .1.3.6.1.6.3.1.1.4.1.0=.1.3.6.1.4.1.17236.2.1 .1.3.6.1.4.1.17236.1.1="MAJOR : 007 023009 000000 10/01/2025 17:14:37 : Shout.Ocp.OcpLink (127.0.0.1:10012) has failed. Reason: Unexpected error in Heartbeat thread."
17:14:41.627673 IP 10.7.7.113.34462 > 10.5.5.122.snmptrap: V2Trap(230) .1.3.6.1.2.1.1.3.0=1877147778 .1.3.6.1.6.3.1.1.4.1.0=.1.3.6.1.4.1.17236.2.1 .1.3.6.1.4.1.17236.1.1="MAJOR : 007 023009 000000 10/01/2025 17:14:41 : Shout.Ocp.OcpLink (127.0.0.1:10012) has failed. Reason: Unable to read beyond the end of the stream..
是的,日志中没有任何内容。这是我在 /etc/snmp/snmptrap.conf 中看到的内容。
#Zabbix 1 and 2
disableAuthorization yes
authCommunity execute public
#Zabbix SNMP trap receiver
perl do "/usr/bin/zabbix_trap_receiver.pl";
我也尝试过使用 bash 脚本,但仍然没有成功。Selinux 被禁用,防火墙也是如此。我没有收到任何错误消息,/var/log/messages 中也没有显示任何问题。我有点困惑,因为似乎没有什么问题。