You can use the ESXi SNMP agent to send virtual machine and environmental notifications to management systems.

To send SNMP v1/v2c notifications with the SNMP agent, you must configure the target (receiver) unicast 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 run 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.

Prerequisites

Configure the ESXi SNMP agent by using the ESXCLI commands. See Getting Started with vSphere Command-Line Interfaces for more information on how to use ESXCLI.

Procedure

  1. Run the esxcli system snmp set command with the --targets option:
    esxcli system snmp set --targets target_address@port/community
    Here, target_address is the address of the target system, port is the port number to send the notifications to, and community is the community name.

    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, run the following command for configuring the targets 192.0.2.1@163/westnoc and 2001:db8::1@163/eastnoc:
    esxcli system snmp set --targets 192.0.2.1@163/westnoc,2001:db8::1@163/eastnoc
  2. (Optional) If the ESXi SNMP agent is not enabled, run the following command:
    esxcli system snmp set --enable true
  3. (Optional) Send a test trap to verify that the agent is configured correctly by running the esxcli system snmp test command.
    The agent sends a warmStart trap to the configured target.