How about we turn it into a programming question! You could use this code (C#), though I would recommend modifying it a bit (e.g. put url's in a file) and throwing it into a service.
This code sets up a certificate validation callback which the HttpWebRequest will call anytime it encounters a certificate. This lets us take a look at the certificate, usually this is used to validate the cert but we are going to look at the expiration time and if it within 3 months we will send an email to ourselves. A timer is setup to run the check once a day.
using System.Net;
using System.Diagnostics;
using System.Net.Mail;
using System.Threading;
static void Main(string[] args)
{
// List of URL's to check
string[] urls = new string[]{
"https://www.6bit.com/",
"https://www.google.com/"
};
HttpWebRequest req = null;
// Certificate check callback
ServicePointManager.ServerCertificateValidationCallback = (state, cert, certChain, sslerr) =>
{
DateTime expiration = DateTime.Parse(cert.GetExpirationDateString());
if (expiration < DateTime.Now.AddMonths(3))
{
Debug.WriteLine("Cert expiring on " + expiration.ToShortDateString());
MailMessage msg = new MailMessage("[email protected]", "[email protected]", "SSL Certificate Expiring", "The ssl certificate for" + req.RequestUri.ToString() + " will expire on " + expiration.ToShortDateString());
SmtpClient sc = new SmtpClient();
sc.Send(msg);
}
return true;
};
// Request each url once a day so that the validation callback runs for each
Timer t = new Timer(s =>
{
Array.ForEach(urls, url =>
{
try
{
req = (HttpWebRequest)HttpWebRequest.Create(url);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
resp.Close();
}
catch (Exception ex)
{
Debug.WriteLine("Error checking site: " + ex.ToString());
}
});
}, null, TimeSpan.FromSeconds(0), TimeSpan.FromDays(1)); // Run the timer now and schedule to run once a day
}