diff --git a/check_domain b/check_domain index 1df2559..e191de3 100755 --- a/check_domain +++ b/check_domain @@ -23,7 +23,7 @@ # https://github.com/Elyrith/check_domain # ############################################################################### -# VERSION: Version 1.0 +# VERSION: Version 1.1 # AUTHOR: See README. This version updated by Ryan Loudfoot (ryan@delotha.com) PROGRAM=$(whereis -b -B /{bin,sbin,usr,etc} /{bin,sbin,usr,etc}/* -f whois | awk '{print $2}') @@ -129,7 +129,9 @@ case "$domain" in # expiration=$(echo "$out" | awk -F: '/Registrar Expiration Date:/{print substr($0, length($1) + 2)}') # New way (2013-09-06) - expiration=$(echo "$out" | awk -F: '/Expiration Date:/{print substr($0, length($1) + 2);exit;}') +# expiration=$(echo "$out" | awk -F: '/Expiration Date:/{print substr($0, length($1) + 2);exit;}') +# New way (2017-09-06) + expiration=$(echo "$out" | awk '/Registry Expiry Date: /{split($4, a, "-"); printf("%d-%02d-%02d\n", a[1], a[2], a[3])}') ;; *.ru) expiration=$(echo "$out" | awk '/paid-till:/{split($2, a, "."); printf("%s-%s-%s\n", a[1], a[2], a[3])}') @@ -147,8 +149,8 @@ case "$domain" in expiration=$(echo "$out" | awk '/expires:/{split($2, a, "-"); printf("%s-%s-%s\n", a[1], a[2], a[3])}') ;; *.net) - expiration=$(echo "$out" | awk -F: '/ Expiration Date:/{print substr($0, length($1) + 3, 11)}') - ;; + expiration=$(echo "$out" | awk '/Registry Expiry Date: /{split($4, a, "-"); printf("%d-%02d-%02d\n", a[1], a[2], a[3])}') + ;; *.org) expiration=$(echo "$out" | awk -F: '/ Expiry Date:/{print substr($0, length($1) + 3, 10)}') ;; @@ -186,3 +188,4 @@ expdays=$((diffseconds/86400)) echo "OK - Domain will expire in $expdays days ($expdate). | Warning: $warning, Critical: $critical" exit $STATE_OK + diff --git a/readme b/readme index fce8142..15629ac 100644 --- a/readme +++ b/readme @@ -1,3 +1,5 @@ +UPDATE 2017-09-07: Updated .net and .com since they changed the whois format / Jack-Benny Persson. + UPDATE 2015-03-27: I've found the original plugin (still maintained by Elan) on GitHub at https://github.com/glensc/nagios-plugin-check_domain. It has improved much more than this one so I've contributed the minor additions from this repo upstream and am going to switch to that version. If you want to use this version because you find it simpler, that is fine. I won't be deleting it. I will test and accept pull requests, but won't be doing much more.