Linux开启snmp监控后大量 Received SNMP packet(s) from UDP 的解决方法

时间:2021-12-09 03:23:59

Jan 9 11:54:08 i snmpd[2193]: Connection from UDP: [60.195.249.83]:37412 
Jan 9 11:54:08 i snmpd[2193]: Received SNMP packet(s) from UDP: [60.195.249.83]:37412 
Jan 9 11:54:08 i snmpd[2193]: Connection from UDP: [60.195.249.83]:18749 
Jan 9 11:54:09 i snmpd[2193]: Connection from UDP: [60.195.249.83]:37412 
Jan 9 11:54:09 i snmpd[2193]: Connection from UDP: [60.195.249.83]:18749 
Jan 9 11:54:09 i snmpd[2193]: Connection from UDP: [60.195.249.83]:51089 
Jan 9 11:54:09 i snmpd[2193]: Received SNMP packet(s) from UDP: [60.195.249.83]:51089 
Jan 9 11:54:09 i snmpd[2193]: Connection from UDP: [60.195.249.83]:18749 
Jan 9 11:54:09 i snmpd[2193]: Connection from UDP: [60.195.249.83]:51089 
Jan 9 11:54:09 i snmpd[2193]: Connection from UDP: [60.195.249.83]:18749 

无用的信息太多了。 

不想看到这些多链接信息可以调整一下snmpd的debug级别: 

# echo "OPTIONS=\"-LS3d -Lf /dev/null -p /var/run/snmpd.pid\"" >> /etc/sysconfig/snmpd.options 

或者直接改启动脚本 

vi /etc/init.d/snmpd 

找到这一项 
OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a" 

改为 
OPTIONS="-LS3d -Lf /dev/null -p /var/run/snmpd.pid" 

snmpd日志等级的定义: 

0 或 ! —- LOG_EMERG 
1 或 a —- LOG_ALERT 
2 或 c —- LOG_CRIT 
3 或 e —- LOG_ERR 
4 或 w —- LOG_WARNING 
5 或 n —- LOG_NOTICE 
6 或 i —- LOG_INFO 
7 或 d —- LOG_DEBUG 

最后别忘了重启服务 

# service snmpd restart