If you've already made an effort to address all the things you can do on your own and continued to have insomnia, that would be a good indicator to seek medical attention.
Start by seeing your primary care physician. They can often help you work through some additional factors that may be contributing to your insomnia before recommending or prescribing any type of medication to improve your ability to fall asleep or staying asleep. In some instances, they may even recommend that you undergo a sleep study along with consultation with the physician who specializes in sleep disorders.