You can use the ESXi SNMP agent to send virtual machine and environmental traps to management systems.
About this task
To send SNMP v1/v2c traps with the SNMP agent, you must configure the target (receiver) address, community, and an optional port. If you do not specify a port, the SNMP agent sends traps to UDP port 162 on the target management system by default.
To configure SNMP v3 traps, see Configure SNMP v3 Targets.
If you use ESXCLI commands through vCLI, you must supply connection options that specify the target host and login credentials. If you use ESXCLI commands directly on a host using the ESXi Shell, you can use the commands as given without specifying connection options. For more information on connection options see vSphere Command-Line Interface Concepts and Examples.
SNMP configuration for ESXi requires the ESXCLI command set. See Getting Started with vSphere Command-Line Interfaces for more information on how to access ESXCLI.
- Type esxcli system snmp set --targets target_address@port/community.
Replace target_address, port, and community with the address of the target system, the port number to send the traps to, and the community name, respectively. 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.
For example, to send SNMP traps from the host host.example.com to port 162 on target.example.com using the public community, type esxcli system snmp set --targets target.example.com@162/public.
- (Optional) If the SNMP agent is not enabled, enable it by typing esxcli system snmp set --enable true.
- (Optional) Send a test trap to verify that the agent is configured correctly by typing esxcli system snmp test.
The agent sends a warmStart trap to the configured target.