Configure a Trap
Destination with ESXCLI
You can use ESXCLI
to configure a trap destination and send traps.
Specify one of the options
listed in
Connection Options for ESXCLI Host Management Commands
in place of
<conn_options>
.
- Make sure a community is set up.esxcli system snmp get <conn_options>Current SNMP agent settings: Enabled: 1 UDP port: 161 Communities: public Notification targets:
- Set the target address, port number, and community.esxcli <conn_options> system snmp set -t target.example.com@163/publicEach time you specify a target with this command, the settings you specify overwrite all previously specified settings. To specify multiple targets, separate them with a comma.You can change the port that the SNMP agent sends data to on the target using the--targetsoption. That port is UDP 162 by default.
- Enable the SNMP agent if it is not yet running.esxcli <conn_options> system snmp set --enable=yes
- Send a test trap to verify that the agent is configured correctly.esxcli <conn_options> system snmp testThe agent sends awarmStarttrap to the configured target.