[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] how to get dnsreg to work .. ?
- To: hobbit (at) hswn.dk
- Subject: Re: [hobbit] how to get dnsreg to work .. ?
- From: Ralph Mitchell <ralphmitchell (at) gmail.com>
- Date: Sun, 28 Feb 2010 13:08:10 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=BGrDTRXAwHiPfXTXNhT3B+qQ0Mk4QyqfPs8vWeVv4eE=; b=wwYQK/k3dkXrOPppAwdYGnnnJ7mxdX57dhl+I04Kg2eO1mqv2ByD0QAGTQ3sOHtc1j aXufNbed0ebMSOMptKUycE7bLFN6O9qfCP8ojw5auqWv3yJjnFHafTn85Im2YoRpvHaJ lMYwZAuLHmaH4Mhxm3v0eIG9Bt1gTY3DN33Xc=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=gGDjq41OwtjaLJo/VMxewcfV0A86ur2z7TOSMfl/LKgXYB2pV/DlniOKM3i82HsU6h KSju2u+vs05V7BS+1tcA7sqwxTVFTFjyOU6ENombAzbNqRTFx1Kph8WHJjImTPOUjjqR JKad4a1g4a0xmJJ4Lk4a9U7q7FKuE9ozRQets=
- References: <b5e7736b1002280746q45a12a1eoa26d964ffb78a7a (at) mail.gmail.com> <b5e7736b1002280831s6bb54ae1l5892e29529bc8569 (at) mail.gmail.com>
I see a couple of things that could be wrong. Possibly you should be doing
"DOMAIN=$2" in the loop?? $1 is the ip address, $2 is the fully-qualified
hostname. It seemed to work just fine when I replaced the bbhostgrep line
with
echo "yahoo.com" | while read L
Definitely you should be converting the dots in $DOMAIN to commas. See the
second paragraph under "XYMON MESSAGE SYNTAX" in the bb.1 manpage. This
would do it:
DOM=`echo $DOMAIN | sed -e 's/\./,/g'`
echo $BB $BBDISP "status+12h $DOM.dnsreg $COLOR `date`
You can test your script using bbcmd:
server/bin/bbcmd server/ext/dnsreg
That kicks off the script with the same environment that Xymon gives it.
You probably want to put a 'set -x' in at the top, to see everything
that's going on. I generally put an "echo" in front of the $BB line when
testing, to minimize the amount of bogus reports going to the server.
Ralph Mitchell
On Sun, Feb 28, 2010 at 11:31 AM, meepmeep @ Fantasya.org <
meepmeep (at) fantasya.org> wrote:
> Hi
>
> I tried to get dnsreg script working, and it's a complete failure ..
> Here what's I've done so far :
>
> 1/ Creating dnsreg script in server/ext/dnsreg (the one from xymon.com,
> with a little modification).
> My version :
>
> #!/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.
>
> BBHTAG=dnsreg
> COLUMN=$BBHTAG
> NOW=`date "+%s"`
> WARNTIME=`expr $NOW + 864000` # 10 days
> ALARMTIME=`expr $NOW + 432000` # 5 day
>
> /home/xmon/server/bin/bbhostgrep dnsreg | while read L
> do
> set $L
> DOMAIN=$1
>
> EXPIRESTRING="`whois $DOMAIN | egrep -i
> "Expires.*:|Expiration.*:|Renewal.*:" | head -n 1 | cut -d: -f2 | sed
> -e's/^[ ]*//' | cut -f1 -d' '`"
> 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+12h $DOMAIN.dnsreg $COLOR `date`
>
> Domain $DOMAIN expires on $EXPIRESTRING
> "
> done
>
> exit 0
>
>
> 2/ Modify "server/etc/hobbitlaunch.cfg" to add :
>
> [dnsreg]
> ENVFILE /home/xmon/server/etc/hobbitserver.cfg
> CMD /home/xmon/server/ext/dnsreg
> LOGFILE $BBSERVERLOGS/bb-dnsreg.log
> INTERVAL 5m
>
> 3/ Modify bb-hosts to add domain with dnsreg test:
>
> group-compress <font size="+1">Servers</font>
> ...
> [My classic test, working great]
> ...
>
> groupe-compress <font size="+1">Domains</font>
> 0.0.0.0 firstdomain.tld # noconn dnsreg
> 0.0.0.0 second.tld # noconn dnsreg
> 0.0.0.0 etc.tld # noconn dnsreg
> 0.0.0.0 etcetc.tld # noconn dnsreg
>
> Log is still empty, I try to restart/reload hobbit.sh. Nothing show on the
> website concerning the "Domains" (all others tests are still showing).
> Moreover, I would like to test the script on a standalone way, but I
> haven't found the way to do it (like using hobbitd_alert --test)
>
> I'm using xymon 4.3.0.0beta2 on debian, and all other tests are working
> great :)
>
> --
> Nicolas G. / meepmeep
>
>