Skip to content

Instantly share code, notes, and snippets.

@Justinzobel
Created August 1, 2025 02:06
Show Gist options
  • Save Justinzobel/4bdd884360cecdafa3255c221cc299c9 to your computer and use it in GitHub Desktop.
Save Justinzobel/4bdd884360cecdafa3255c221cc299c9 to your computer and use it in GitHub Desktop.
Get SSL expiry days for domains in Uptime Kuma into CSV
#!/usr/bin/sh
# This script generates a list of urls domains monitored and checks their SSL expiry date
cd /home/uptime-kuma/uptime-kuma/data
if [ -f /tmp/ssl-check-data ];then rm /tmp/ssl-check-data;fi
sqlite3 kuma.db 'select id from monitor_tls_info' > /tmp/ssl-check-data-IDs
while read id
do
domain=$(sqlite3 kuma.db "select info_json from monitor_tls_info where id = '${id}';" | jq .certInfo.subject.CN | sed 's/\"//g')
days=$(sqlite3 kuma.db "select info_json from monitor_tls_info where id = '${id}';" | jq .certInfo.daysRemaining)
echo "${days},${domain}" >> /tmp/ssl-check-data
sleep 0.05
done < /tmp/ssl-check-data-IDs
sort -u -o /tmp/ssl-check-data /tmp/ssl-check-data
@Justinzobel
Copy link
Author

Requires sqlite3 and jq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment