Skip to content

Instantly share code, notes, and snippets.

@christophlehmann
Created September 15, 2016 10:02
Show Gist options
  • Save christophlehmann/9df199bebbeb8685578e4fd16adbaf01 to your computer and use it in GitHub Desktop.
Save christophlehmann/9df199bebbeb8685578e4fd16adbaf01 to your computer and use it in GitHub Desktop.
Check expiry of SSL certificates used in apache with nagios check_http
#!/bin/bash
SSL_CERTIFICATE_WARN_DAYS=7
source /etc/(apache2|httpd)/envvars
for i in `apache2 -S 2>/dev/null | grep "port 443" | awk '{print $4}' | sort | uniq`
do
/usr/lib/nagios/plugins/check_http -H $i -C $SSL_CERTIFICATE_WARN_DAYS | xargs echo "$i" | grep -v 'OK -'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment