Created
August 1, 2025 02:06
-
-
Save Justinzobel/4bdd884360cecdafa3255c221cc299c9 to your computer and use it in GitHub Desktop.
Get SSL expiry days for domains in Uptime Kuma into CSV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires sqlite3 and jq