[Xymon] Run Single Test
John Tullis
john at executech.com
Thu Mar 26 18:17:36 CET 2015
I'm currently running the DNSREG script. I'm querying over 250 domains and toward the end, the whois server blocks me so all of the domains after that point report red. I'm trying to figure out a way to fix that. It's set to run every 24 hours.
1) Is there a way to set it to check 50 domains every four hours or so instead of running all of them at midnight.
2) Does Xymon have a way to know when it queried the host last and then will wait, on that single host, 24 hours or will it just do all of them again after 24 hours? I did try putting a pause in the script and it wouldn't run at all after that.
3) When one does fail, I would like to run it later (when the registrar block has expired) for the 10 or so hosts that failed. I tried using bbcmd to kick off the script for just that host and just that test but nothing happened. (bbcmd bbtest-net domain.org.dnsreg)
4) I'm sure I can figure this out but if anyone knows off the top of their head: if the expires line returns blank (because no date could be found), how would I append the script to return a clear status instead of red?
This is how I have the script set up:
This is the cfg entry:
[dnsreg]
ENVFILE /usr/lib/hobbit/client/etc/hobbitclient.cfg
CMD /usr/lib/hobbit/server/ext/dnsreg.sh
LOGFILE $BBSERVERLOGS/bb-dnsreg.log
INTERVAL 1440m
This is the DNSREG file
# 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
/usr/lib/hobbit/server/bin/bbhostgrep dnsreg | while read L
do
set $L
DOMAIN=$2
EXPIRESTRING="`whois $DOMAIN | egrep -i "Expires.*:|Expiration.*:|Renewal.*:|expir.*date:" | 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
$BB $BBDISP "status+90000 $DOMAIN.dnsreg $COLOR `date`
Domain $DOMAIN expires on $EXPIRESTRING
"
done
exit 0
John Tullis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20150326/d7757700/attachment.html>
More information about the Xymon
mailing list