I am having an issue trying to get the dnsreg script working. I install it and all and when I go to test it I get this (I took out my domain). Any help would be appreciated.
Thanks
./dnsreg.sh: line 31: status+90000 mydomain.com.dnsreg red Thu Sep 20 17:27:42 EDT 2012
Domain mydomain.com expires on
: command not found
The script looks like this:
#!/bin/sh
Check DNS registrations in whois and warn when they are about to
expire.
NOTE: Requires a "whois" command that knows what servers to query.
Requires GNU date.
Should run only once a day.
NOW=date "+%s"
WARNTIME=expr $NOW + 864000 # 10 days
ALARMTIME=expr $NOW + 432000 # 5 day
/home/xymon/server/bin/xymongrep dnsreg | while read L
do
set $L
DOMAIN=$2
EXPIRESTRING="`whois $DOMAIN | egrep -i
"Expires.*:|Expiration.*:|Renewal.*:" | head -n 1 | cut -d: -f2 | sed -e's/^[ ]*//'`"
EXPIRES=`date --date="$EXPIRESTRING" "+%s"`
if test $EXPIRES -le $ALARMTIME
then
COLOR=red
elif test $EXPIRES -le $WARNTIME
then
COLOR=yellow
else
COLOR=green
fi
$XYMON $XYMDISP "status+90000 $DOMAIN.dnsreg $COLOR `date`
Domain $DOMAIN expires on $EXPIRESTRING
"
done
I'm guessing you don't have 'whois' available or in the path.
From: xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] On Behalf Of Russell Blumenthal Sent: Thursday, September 20, 2012 4:30 PM To: xymon at xymon.com Subject: [Xymon] dnsreg script question
I am having an issue trying to get the dnsreg script working. I install it and all and when I go to test it I get this (I took out my domain). Any help would be appreciated.
Thanks
./dnsreg.sh: line 31: status+90000 mydomain.com.dnsreg red Thu Sep 20 17:27:42 EDT 2012
Domain mydomain.com expires on : command not found
The script looks like this:
#!/bin/sh
Check DNS registrations in whois and warn when they are about to expire.
NOTE: Requires a "whois" command that knows what servers to query.
Requires GNU date.
Should run only once a day.
NOW=date "+%s"
WARNTIME=expr $NOW + 864000 # 10 days
ALARMTIME=expr $NOW + 432000 # 5 day
/home/xymon/server/bin/xymongrep dnsreg | while read L do set $L DOMAIN=$2
EXPIRESTRING="`whois $DOMAIN | egrep -i "Expires.*:|Expiration.*:|Renewal.*:" | head -n 1 | cut -d: -f2 | sed -e's/^[ ]*//'`"
EXPIRES=`date --date="$EXPIRESTRING" "+%s"`
if test $EXPIRES -le $ALARMTIME
then
COLOR=red
elif test $EXPIRES -le $WARNTIME
then
COLOR=yellow
else
COLOR=green
fi
$XYMON $XYMDISP "status+90000 $DOMAIN.dnsreg $COLOR `date`
Domain $DOMAIN expires on $EXPIRESTRING " done
I installed 'whois' and I am able to do a manual query 'whois domain.com'. but unable to run the script manually to test it.
From: Dugan, Darin D [EIT] [mailto:dddugan at iastate.edu] Sent: Friday, September 21, 2012 9:05 AM To: Russell Blumenthal; xymon at xymon.com Subject: RE: dnsreg script question
I'm guessing you don't have 'whois' available or in the path.
From: xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] On Behalf Of Russell Blumenthal Sent: Thursday, September 20, 2012 4:30 PM To: xymon at xymon.com Subject: [Xymon] dnsreg script question
I am having an issue trying to get the dnsreg script working. I install it and all and when I go to test it I get this (I took out my domain). Any help would be appreciated.
Thanks
./dnsreg.sh: line 31: status+90000 mydomain.com.dnsreg red Thu Sep 20 17:27:42 EDT 2012
Domain mydomain.com expires on
: command not found
The script looks like this:
#!/bin/sh
Check DNS registrations in whois and warn when they are about to
expire.
NOTE: Requires a "whois" command that knows what servers to query.
Requires GNU date.
Should run only once a day.
NOW=date "+%s"
WARNTIME=expr $NOW + 864000 # 10 days
ALARMTIME=expr $NOW + 432000 # 5 day
/home/xymon/server/bin/xymongrep dnsreg | while read L
do
set $L
DOMAIN=$2
EXPIRESTRING="`whois $DOMAIN | egrep -i
"Expires.*:|Expiration.*:|Renewal.*:" | head -n 1 | cut -d: -f2 | sed -e's/^[ ]*//'`"
EXPIRES=`date --date="$EXPIRESTRING" "+%s"`
if test $EXPIRES -le $ALARMTIME
then
COLOR=red
elif test $EXPIRES -le $WARNTIME
then
COLOR=yellow
else
COLOR=green
fi
$XYMON $XYMDISP "status+90000 $DOMAIN.dnsreg $COLOR `date`
Domain $DOMAIN expires on $EXPIRESTRING
"
done
hi
To debug your script; run it like that: sh -x ./dnsreg.sh you ll see where the error is directly.
don't forget to load xymon env before : ~xymon/server/bin/xymoncmd
cheers nico
Le 20 sept. 2012 à 23:29, Russell Blumenthal a écrit :
I am having an issue trying to get the dnsreg script working. I install it and all and when I go to test it I get this (I took out my domain). Any help would be appreciated.
Thanks
./dnsreg.sh: line 31: status+90000 mydomain.com.dnsreg red Thu Sep 20 17:27:42 EDT 2012
Domain mydomain.com expires on : command not found
The script looks like this:
#!/bin/sh
Check DNS registrations in whois and warn when they are about to expire.
NOTE: Requires a "whois" command that knows what servers to query.
Requires GNU date.
Should run only once a day.
NOW=
date "+%s"WARNTIME=expr $NOW + 864000# 10 days ALARMTIME=expr $NOW + 432000# 5 day/home/xymon/server/bin/xymongrep dnsreg | while read L do set $L DOMAIN=$2
EXPIRESTRING="`whois $DOMAIN | egrep -i "Expires.*:|Expiration.*:|Renewal.*:" | head -n 1 | cut -d: -f2 | sed -e's/^[ ]*//'`" EXPIRES=`date --date="$EXPIRESTRING" "+%s"` if test $EXPIRES -le $ALARMTIME then COLOR=red elif test $EXPIRES -le $WARNTIME then COLOR=yellow else COLOR=green fi $XYMON $XYMDISP "status+90000 $DOMAIN.dnsreg $COLOR `date`Domain $DOMAIN expires on $EXPIRESTRING " done
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
participants (3)
-
dddugan@iastate.edu
-
nicolas@lienard.name
-
rblumenthal@telmar.com