Enable SNMP & Traps on ESXi

SSH or Telnet to your ESXi node using root-level credentials, then enter the following commands to enable and configure SNMP.

For ESXi 5.5 :

esxcli system snmp set --communities YOUR_STRING
esxcli system snmp set --enable true
esxcli network firewall ruleset set --ruleset-id snmp --allowed-all true
esxcli network firewall ruleset set --ruleset-id snmp --enabled true
/etc/init.d/snmpd restart

For ESXi 6.x :

esxcli system snmp set -r
esxcli system snmp set -c YOUR_STRING
esxcli system snmp set -p 161
esxcli system snmp set -L "City, State, Country"
esxcli system snmp set -C noc@example.com
esxcli system snmp set -e yes
Note Replace YOUR_STRING with your desired community string.