Skip to content


snmpd输出日志的过滤

messages会有很多snmpd的信息,影响阅读正常信息
#tail /var/log/messages

Jan 19 10:01:07 touran snmpd[4033]: Received SNMP packet(s) from UDP: [127.0.0.1]:5392
Jan 19 10:01:07 touran snmpd[4033]: Connection from UDP: [127.0.0.1]:5392
Jan 19 10:01:07 touran last message repeated 10 times
Jan 19 10:04:09 touran snmpd[4033]: Connection from UDP: [127.0.0.1]:5396
Jan 19 10:04:09 touran snmpd[4033]: Received SNMP packet(s) from UDP: [127.0.0.1]:5396
Jan 19 10:04:09 touran snmpd[4033]: Connection from UDP: [127.0.0.1]:5396
Jan 19 10:06:07 touran last message repeated 11 times
Jan 19 10:06:07 touran last message repeated 11 times

我们可以重新定义snmpd的日志输出级别来降低垃圾信息
我这里是centos的系统
#vi /etc/init.d/snmpd

OPTIONS=”-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a”

修改此行为下面

OPTIONS=”-LS 0-4 d -Lf /dev/null -p /var/run/snmpd.pid -a”

重启snmpd
#/etc/init.d/snmpd restart

详细的参数意思
可以用 man snmpd和man snmpcmd来查看
man snmpcmd中对日志等级的定义
0 or ! for LOG_EMERG,
1 or a for LOG_ALERT,
2 or c for LOG_CRIT,
3 or e for LOG_ERR,
4 or w for LOG_WARNING,
5 or n for LOG_NOTICE,
6 or i for LOG_INFO, and
7 or d for LOG_DEBUG.

参考:http://www.diybl.com/course/6_system/linux/Linuxjs/2008930/146976.html

Posted in linux 维护优化, 技术, 日志.

Tagged with , .


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.