我正在使用net-snmp在Linux中收集系统信息。 但我发现有问题。如何更改linux中的net-snmp陷阱发送端口?
当我通过netstat检查Net-SNMP的端口使用情况时,发现使用3个UDP端口的net-snmp。
这是结果。
[[email protected] snmp]# netstat -anp | grep snmp
tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN 6392/snmpd
udp 0 0 0.0.0.0:49005 0.0.0.0:* 6392/snmpd
udp 0 0 0.0.0.0:161 0.0.0.0:* 6392/snmpd
udp 0 0 0.0.0.0:44837 0.0.0.0:* 6392/snmpd
,你可以看到,使用2个UDP端口,而161 的SNMPD还我发现为什么2个UDP端口随机通过SNMP占据。
这些端口用于发送snmp陷阱。 当我删除tran2sink和通知连接选项时,不再出现2个UDP端口。
这是我的snmpd.conf
###########################################################################
# SECTION: Trap Destinations
#
# Here we define who the agent will send traps to.
# trap2sink: A SNMPv2c trap receiver
# arguments: host [community] [portnum]
trap2sink 192.168.1.4
# informsink: A SNMPv2c inform (acknowledged trap) receiver
# arguments: host [community] [portnum]
informsink 192.168.1.4 NMS_COM
# trapcommunity: Default trap sink community to use
# arguments: community-string
trapcommunity NMS_COM
# authtrapenable: Should we send traps when authentication failures occur
# arguments: 1 | 2 (1 = yes, 2 = no)
authtrapenable 1
我的程序必须使用40000〜50000的UDP端口的配置的一部分。 所以我想使用这些陷阱选项并更改端口。
我该如何修复端口?
2015-07-01
Jeong