Updated .net and .com

This commit is contained in:
Jack-Benny Persson 2017-09-07 06:10:04 +02:00
parent 776e05f1dd
commit 62de166ad2
2 changed files with 9 additions and 4 deletions

View File

@ -23,7 +23,7 @@
# https://github.com/Elyrith/check_domain # # 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) # 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}') 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)}') # expiration=$(echo "$out" | awk -F: '/Registrar Expiration Date:/{print substr($0, length($1) + 2)}')
# New way (2013-09-06) # 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) *.ru)
expiration=$(echo "$out" | awk '/paid-till:/{split($2, a, "."); printf("%s-%s-%s\n", a[1], a[2], a[3])}') 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])}') expiration=$(echo "$out" | awk '/expires:/{split($2, a, "-"); printf("%s-%s-%s\n", a[1], a[2], a[3])}')
;; ;;
*.net) *.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) *.org)
expiration=$(echo "$out" | awk -F: '/ Expiry Date:/{print substr($0, length($1) + 3, 10)}') 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" echo "OK - Domain will expire in $expdays days ($expdate). | Warning: $warning, Critical: $critical"
exit $STATE_OK exit $STATE_OK

2
readme
View File

@ -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. 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. 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.