This template allows you to turn web monitoring steps from Zabbix into an LLD to also monitor them for certificate expiration. It requires two PHP files, two UserParameters, an SQL user with SELECT permissions and this template to get up and running.
mkdir /etc/zabbix/scripts && git clone https://github.com/albinbatman/zabbix-ssl-monitor-template /etc/zabbix/scripts
cd /etc/zabbix/scripts/zabbix-ssl-monitor-template
Open up SQL.php and adjust the following lines
private $host = "dns or ip to database";
private $user = "your username for sql";
private $pass = "your user sql password";
private $db = "zabbix";
private $table = "httptest"; // keep this as it is
Edit zabbix_agentd.conf with the following:
UserParameter=get.urls,php /etc/zabbix/scripts/zabbix-ssl-monitor-template/scripts/SQL.php
UserParameter=get.ssl[*],php /etc/zabbix/scripts/zabbix-ssl-monitor-template/scripts/SSL.php $1
Since the items will go into unsupported state if an error with the script occurs (such as can't verify certificate), please follow this documentation to setup alerting for it: Receiving notification on unsupported items [Zabbix Documentation 5.0]
Another tip is to only use this template once per database, ie do not use this template on two hosts that have access to the same database because it will create duplicates.