Next: The Net-SNMP C API
Up: Trap Handlers
Previous: A Simple Trap Handler
Contents
The trap daemon needs to be started explicitly in order to listen for traps. It can
be started in whichever method your OS prefers (/etc/rc.local or an initscript).
You can pass a variety of arguments to the daemon, such as a list of MIBs to be used (-m)
or tell it to run in the foreground for debugging purposes (-f).
Here is an example init script:
#!/sbin/sh
#
case "$1" in
start)
[ -f /usr/local/share/snmp/mibs/extreme620.mib ] || exit 0
/usr/local/sbin/snmptrapd -m /usr/local/share/snmp/mibs/extreme620.mib -n
;;
stop)
pkill snmptrapd
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0
In this case the script ensures that the required MIB is present before starting
the trap daemon. -m specifies the MIB (or list of MIBs) for the trap daemon to
use and -n specifies that source addresses should not be translated into hostnames.
2004-11-23