[CentOS] snmpd log messages

Paul R. Ganci ganci at nurdog.com
Sun May 20 21:01:25 UTC 2007


Paul R. Ganci wrote:
> May 20 10:40:03 mx01 snmpd[2572]: Connection from - 127.0.0.1
> May 20 10:40:03 mx01 snmpd[2572]: transport socket = 12
>
> Is there a way to turn off this useless logging?
Ok I found the answer to this problem. The /etc/rc.d/init.d/snmpd script 
contains the following code snippet:

if [ -e /etc/sysconfig/snmpd.options ]; then
  . /etc/sysconfig/snmpd.options
else
  OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"
fi

Note that the OPTIONS= line indicates that smnpd starts with both -Lsd 
and -Lf /dev/null. As a result a ps auxww shows:

root     19645  0.0  0.2 12340 4436 ?        S    12:05   0:00 
/usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a

and apparently the -Lsd overrides the -Lf /dev/null so everything gets 
logged. If I create a /etc/sysconfig/snmpd.options file containing:

OPTIONS="-LS 4 d -p /var/run/snmpd.pid -a"

then only warnings or worse are logged to /var/log/messages and the 
useless connection messages get suppressed. The key is to remove the -Lf 
/dev/null and replace -Lsd with -LS 4 d. The latter switch says to use 
syslog to log messages from the daemon, but only if the priority is 
warning or worse. No more unwanted log entries.

-- 
Paul (ganci at nurdog.com)




More information about the CentOS mailing list