Get the current config

esxcli system snmp get

enable v2

esxcli system snmp set --communities public

Enable snmpd

esxcli system snmp set --enable true

allow requests through the firewall

Only from the local subnet though

esxcli network firewall ruleset set --ruleset-id snmp --allowed-all false
esxcli network firewall ruleset allowedip add --ruleset-id snmp --ip-address 10.35.36.0/24
esxcli network firewall ruleset set --ruleset-id snmp --enabled true