How does snmpd know where to send a trap?

Andy asked:

I’m trying to get my head around our snmpd.conf file in order to begin managing snmp with puppet. The existing file has several alarms setup for things like excessive disk space, load, etc. I’m assuming that when these conditions are reached an snmp trap is sent to the manager. However, the snmpd.conf file does not contain any manager setup or information. In other words there is no mention of a host or port where the manager runs. Thus, how does it know where to send traps? Is there some discover protocol?

My answer:

At a minimum, you need to define trapsink, trap2sink or informsink in /etc/snmp/snmpd.conf to specify the host to send SNMP traps to. You can also specify the community string and an alternate port number (if not using 162).

You can also set a trapcommunity for a default community string to be used when sending traps.

For sending v3 traps, use trapsess.

See the snmpd.conf man page for full details. See also the net-snmp snmptrap tutorial and snmptrap v3 tutorial.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.