Or with Prometheus: https://github.com/prometheus/blackbox_exporter

https endpoints will include the probe_ssl_earliest_cert_expiry metric, which is the expiration in UNIX epoch seconds. Use with the builtin time() function.