From 595c3cc03ba3906891497a3ead8c5d4c96c59b0b Mon Sep 17 00:00:00 2001 From: Elyrith Date: Thu, 22 Aug 2013 22:10:09 -0400 Subject: [PATCH] Add nagios exit state constants --- check_domain | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/check_domain b/check_domain index eb7577e..da1f6ea 100755 --- a/check_domain +++ b/check_domain @@ -30,12 +30,22 @@ PROGRAM=${0##*/} PROGPATH=${0%/*} # Ryan's note: utils.sh is installed with nagios-plugins in with the plugins -. $PROGPATH/utils.sh +# Added nagios exit state constants instead of utils.sh so you can run it anywhere +# instead of only in the libexec folder +#. $PROGPATH/utils.sh +STATE_OK=0 +STATE_WARNING=1 +STATE_CRITICAL=2 +STATE_UNKNOWN=3 +STATE_DEPENDENT=4 # Default values (days): critical=7 warning=30 +# Array for converting 3-letter month into number +MONTH=("jan" "feb" "mar" "apr" "may" "jun" "jul" "aug" "sep" "oct" "nov" "dec") + # Parse arguments args=$(getopt -o hd:w:c:P: --long help,domain:,warning:,critical:,path: -u -n $PROGRAM -- "$@") if [ $? != 0 ]; then @@ -127,6 +137,12 @@ case "$domain" in *.se) expiration=$(echo "$out" | awk '/expires:/{split($2, a, "-"); printf("%s-%s-%s\n", a[1], a[2], a[3])}') ;; +*.nu) +# This doesn't work, yet. Need to convert 3-letter month into number. -Ryan, Aug 21, 2013 + expmonth=$(echo "$out" | awk -F '/Record expires on/{print substr($4, length($1) + 2)}'} + echo $expmonth + expiration=$(echo "$out" | awk '/Record expires on/{split($4, a, "-"); printf("%s-%s-%s\n", a[2], a[3], a[1]);}') + ;; *) expiration=$(echo "$out" | awk -F: '/Expiration Date:/{print substr($0, length($1) + 2)}') ;;