snmpd logging bug

5 01 2007

we’ve had this long standing problem with net-snmp’s snmpd:

snmpd from freebsd ports logs to /var/log/snmpd.log. we setup newsyslog.conf to rotate this file and send snmpd a SIGHUP, but, as would be our luck, this either crashes snmpd or doesn’t rotate the log (thus holding the file descriptor open and causing filesystem to grow ad infinium or until it fills up and crashes our application servers).

we thought, why not tell snmpd to log to syslog with -Lsd. not so fast snmpd said, as it continued to write to /var/log/snmpd.log. eventually we found that no matter what flags you give snmpd on startup, it always logs to /var/log/snmpd.log. well, that was until we read this:

http://sourceforge.net/tracker/index.php?func=detail&aid=1347680&group_id=12694&atid=112694

turns out the work around is to send snmp ‘-l /dev/null’ (a deprecated flag, mind you) and then your ‘-L’ flags.

e.g.: /usr/local/sbin/snmpd -l /dev/null -Lsd -p /var/run/snmpd.pid

or in freebsd’s rc.conf:

snmpd_enable=”YES”
snmpd_flags=”-l /dev/null -Lsd”
snmpd_pidfile=”/var/run/snmpd.pid”


Actions

Information

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>