I am experimenting with sending and receiving SNMP traps via net-SNMP. I have a script that sends traps out to localhost. I have snmptrapd set to write traps to a file. This works fine, except for the fact that there is about a 5 second delay between the trap getting sent and receiving the trap. It is all on the same computer (snmptrapd is running on localhost), so why would there be such a large delay? Also, when I send a large amount of traps at once, like 100 within 5 seconds, it will not write more than 1 every ~5 seconds. Thanks!
Turns out the issue was DNS look ups timing out so I just pushed the
-n flag to the options lines in
/etc/defaults/snmpd. This was on Debian 6.0.
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /var/log/snmpd.log -n -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'
# snmptrapd options (use syslog).
TRAPDOPTS='-Lsd -Lf /var/log/snmptrapd.log -n -u snmp -g snmp -p /var/run/snmptrapd.pid'
This was for: NET-SNMP Version: 5.4.3 on a Debian 6.0 server, the behaviour seems to have changed since Debian 5.0.