I will give an example of setting up SNMP Traps sending on D-Link switches.
For example, I will take the switches D-Link DES-3200-x:
Create an SNMP password:
create snmp community public view CommunityView read_only
We indicate which host and with which password the traps should be sent:
create snmp host x.x.x.x v2c public
We indicate the change in the state of which ports to send traps:
config snmp link_traps ports 01-24 disable config snmp link_traps ports 25-26 enable
Check the configuration of sending snmp traps with the command:
show snmp traps
Check the configuration of sending snmp traps on the status of ports with the command:
show snmp traps link_traps
At the end of the command, you can digitize port numbers.
See also my article:
Installing and using Net-SNMP