Skip to content

 React Three Fiber
 Threejs and TypeScript
 SocketIO and TypeScript
 Blender Topological Earth
 Sweet Home 3D
 Design Patterns Python
 Design Patterns TypeScript
 Course Coupon Codes
Three.js and TypeScript
Kindle Edition
$6.99 $9.99 Paperback 
$22.99 $29.99

Design Patterns in TypeScript
Kindle Edition
$6.99 $9.99 Paperback
$11.99 $19.99

Design Patterns in Python
Kindle Edition
$6.99 $9.99 Paperback
$11.99 $19.99

Execute a Shell Script using Zabbix Agent

Video Lecture

Check SSL Certificate Expiry on Websites using Custom Script and Check SSL Certificate Expiry on Websites using Custom Script and


In this lesson I will run a Shell Script (.sh) using the agent running on my Zabbix Server.

This script will return the number of days remaining before an SSL certificate expires.

You can use any Linux agent you desire to run this script.

Create a folder on the Linux host. (if the folder doesn't already exist)

mkdir /home/zabbix/

CD into the folder

cd /home/zabbix

Then create the script on your server,

sudo nano
data=`echo | openssl s_client -servername $1 -connect $1:${2:-443} 2>/dev/null | openssl x509 -noout -enddate | sed -e 's#notAfter=##'`

ssldate=`date -d "${data}" '+%s'`

nowdate=`date '+%s'`


echo $((${diff}/86400))

Save it, and give it execute permissions.

sudo chmod a+x

Test that it works using



./ 443

Adding port 443 is optional and default. You can put any port here in case your certificate was bound to a different port, e.g., 3000 or 8443

or use any other domain name rather than

Then go into Zabbix and create items that call this script for each website SSL you want to monitor.

Example item key is[/home/zabbix/ 443]

Since the expiry days can go negative, I advise you use the numeric(float) option in the type of information drop down.

Visit Monitoring ⇾ Latest Data to see the values.

Zabbix Agent Items

Restricting Agent Checks