Net-SNMP is the package for all SNMP operations. It can also acts as SNMP Trap Receiver.
First of all, it's good idea to read the section about traps in Net-SNMP Tutorial.
http://www.net-snmp.org/tutorial/tutorial-5/commands/snmptrap.html
Step by step blog post about Sending and Receiving SNMP Traps in FreeBSD can be also found in
http://taosecurity.blogspot.cz/2006/08/sending-and-receiving-snmp-traps.html
Test trap can be send by following command:
snmptrap -v 1 -c public localhost '' localhost 6 1 ''
The daemon for snmp trap receiver is snmptrapd which uses configuration file snmptrapd.conf
Here is example of snmptrapd.conf file:
###########################################################################
#
# snmptrapd.conf
############################################################################
# SECTION: Output formatting for traps received.
#
# Output from snmptrapd is formatted according to the
# rules defined by the formatting configuration directives.
# format1: How SNMPv1 traps are formatted.
# See the snmptrapd.conf manual page for format string details.
# arguments: formatstring
format1 '%y-%m-%l ?%h:%j:%k ?%b ?%P ?%N ?%W ?%v\n'
# format2: How SNMPv2 and SNMPv3 traps are formatted.
# See the snmptrapd.conf manual page for format string details.
# arguments: formatstring
format2 '%y-%m-%l ?%h:%j:%k ?%b ?%P ?%N ?%W ?%v\n'
logOption f /var/log/snmptraps.log
ignoreauthfailure yes
disableAuthorization yes
First of all, it's good idea to read the section about traps in Net-SNMP Tutorial.
http://www.net-snmp.org/tutorial/tutorial-5/commands/snmptrap.html
Step by step blog post about Sending and Receiving SNMP Traps in FreeBSD can be also found in
http://taosecurity.blogspot.cz/2006/08/sending-and-receiving-snmp-traps.html
Test trap can be send by following command:
snmptrap -v 1 -c public localhost '' localhost 6 1 ''
The daemon for snmp trap receiver is snmptrapd which uses configuration file snmptrapd.conf
Here is example of snmptrapd.conf file:
###########################################################################
#
# snmptrapd.conf
############################################################################
# SECTION: Output formatting for traps received.
#
# Output from snmptrapd is formatted according to the
# rules defined by the formatting configuration directives.
# format1: How SNMPv1 traps are formatted.
# See the snmptrapd.conf manual page for format string details.
# arguments: formatstring
format1 '%y-%m-%l ?%h:%j:%k ?%b ?%P ?%N ?%W ?%v\n'
# format2: How SNMPv2 and SNMPv3 traps are formatted.
# See the snmptrapd.conf manual page for format string details.
# arguments: formatstring
format2 '%y-%m-%l ?%h:%j:%k ?%b ?%P ?%N ?%W ?%v\n'
logOption f /var/log/snmptraps.log
ignoreauthfailure yes
disableAuthorization yes
No comments:
Post a Comment