Configure SNMP trap destination using ESXCLI tool
Prerequisites
Steps
-
To download the ESXCLI installer, do the following:
- Open VMware home.
- Click the Resources tab.
- In the Developer Tools section, click Standalone ESXCLI and download the required version of the ESXCLI.
- Install the Standalone ESXCLI tool on a server with supported Microsoft Windows or Linux operating systems installed.
-
Open the
Standalone ESXCLI tool which is available at the following directories:
- Linux—/opt/vmware/esxcli
- Microsoft Windows—C:\Program Files (x86)\VMware\esxcli
-
To set a community name, run the following command:
esxcli --server <ESXi_host_ip> --username <user> --password <password> system snmp set --communities <community_name> -
To set the SNMP trap destination, run the following command:
esxcli --server <ESXi_host_ip> --username <user> --password <password> system snmp set --targets=<trap_destination_ip>@162/public -
To enable the SNMP trap, run the following command:
esxcli --server <ESXi_host_ip> --username <user> --password <password> system snmp set --enable trueIf the firewall blocks the SNMP traffic, run the following commands to change the firewall configuration:
- To enable SNMP traffic, run the following command:
esxcli network firewall ruleset set --ruleset-id snmp --allowed-all true - To enable ruleset, run the following command:
esxcli network firewall ruleset set --ruleset-id snmp --enabled true
NOTE: When you identify certificate-related issues in the remote ESXCLI tool, you must either configure the following:- A valid certificate
- Pass a thumbprint value for a trusted connection with the VMware ESXi host.
For more information about the ESXCLI tool, seeESXCLI 7.0 .
NOTE: The SNMP trap configuration is effective immediately and does not require any Server Administrator services. - To enable SNMP traffic, run the following command: