You can use vicfg-snmp to configure a trap destination and send traps.

Specify one of the options listed in Connection Options for vCLI Host Management Commands in place of <conn_options>.


Make sure a community is set up.

vicfg-snmp <conn_options> --show

Current SNMP agent settings:
Enabled: 1
UDP port: 161
Communities: public
Notification targets:

Run vicfg-snmp --target with the target address, port number, and community.

vicfg-snmp <conn_options> -t

Each 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 --targets option. That port is UDP 162 by default.


(Optional) Enable the SNMP agent if it is not yet running.

vicfg-snmp <conn_options> --enable

(Optional) Send a test trap to verify that the agent is configured correctly.

vicfg-snmp <conn_options> --test

The agent sends a warmStart trap to the configured target.