Luckily there is a script to do exactly this. On Ubuntu you can apt-get-install ssl-cert-check but there are copies of the script online in case your distro doesn't have it as a package.
Create a file with a list of the domains you want to check and the port to check on. It should look something like this:
yourdomain.com 443 www.anotherdomain.com 443 www.yetanotherclientdomain.com 443
Lets assume you called your file domainlist.txt
You can then run ssl-cert-check -f domainlist.txt to get the tool to run through it and display to console the status and expiry date of the domains you provided.
Using the options shown in the help page for the script lets you use the script to send an email to you if a certificate is going to expire soon.
ssl-cert-check -a -f domainlist.txt -q -x 30 -e firstname.lastname@example.org
If you get a message about a missing mail binary you'll spot that in the script (line 243) it looks in a variety of locations for a file called mail or mailx. An appropriate binary in Ubuntu is contained in the heirloom-mailx package so installing that will solve your problem.