SNMPd on my CentOS systems is sending log messages to syslog every time it receives a query from my monitoring tools. Is there a way to lower the verbosity of SNMPd? It adds a lot of clutter to the logs.
Sep 12 13:05:40 myhost snmpd[7073]: Received SNMP packet(s) from UDP: [ipaddr]:42874
Sep 12 13:05:40 myhost snmpd[7073]: Connection from UDP: [ipaddr]:49272
Thanks!
Check the command that starts
snmpd
(possibly somewhere/etc/rc.d/
- in Ubuntu it's/etc/defaults/snmpd
) for the logging options:Or find it in the
ps aux | grep snmpd
output.The man page gives the logging options:
The default is fairly verbose (only 2 levels below debug):
If you're logging to syslog via LOG_DAEMON (-Lsd), you could reduce it to e.g. LOG_WARNING with
-LSwd
/-LS4d
, or LOG_ERR with-LSed
/-LS3d
.(Edited to put the options in the right order.)
In order to set the minimum priority to LOG_WARNING, (which is what I usually use) simply change the argopt:
to
Which stands for:
As stated in the man (but actually missing a clear example):
I.e. add
dontLogTCPWrappersConnects true
to snmpd.conf.I'm puzzled why this log message is considered above LOG_DEBUG, for a monitoring service (and one that supports UDP) :-( .
journalctl -o verbose
shows the message has PRIORITY=6 (INFO), which is the same as the normal startup messages for snmpd.I completely remove the "-Lsd" directive from the
/etc/sysconfig/snmpd.options
file in CentOS/Redhat installations, leaving a file that reads:Including the standard (included in the default
/etc/snmp/snmp.conf
file for CentOS 6.5) line worked for me to reduce the verbosity specifically with respect to TCP/UDP SNMP connection logging:Here is a more "verbose" excerpt from the default
snmp.conf
file:on the raspberry pi / raspbian, the file location is
/lib/systemd/system/snmpd.service
then you have to do a daemon-reload before restarting the snmpd service.
systemctl daemon-reload