Showing 1 changed files with 11 additions and 0 deletions
+11
monitoring.d/common-tests
... ...
@@ -46,3 +46,14 @@ function upgrades () {
46 46
     local status=$(cut -f3 -d' ' <<< $lastline)
47 47
     test $(($lastentry + 86400)) -lt $now && echo "pas de mise à jour depuis le ${lastline%% *}"
48 48
 }
49
+
50
+function certificates () {
51
+    for domain in /etc/letsencrypt/live/*; do
52
+        local notAfter="$(openssl x509 -enddate -noout -in $domain/fullchain.pem)"
53
+        local enddate=$(date +%s -d"${notAfter#*=}")
54
+        local delay=$(date +%_j -d@$(($enddate - $now)))
55
+        if test $delay -lt 10; then
56
+            echo "${domain##*/} expire dans $delay jours"
57
+        fi
58
+    done
59
+}