Xymon Mailing List Archive search

Run Single Test

6 messages in this thread

list John Tullis · Thu, 26 Mar 2015 17:17:36 +0000 ·
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
list John Thurston · Thu, 26 Mar 2015 09:32:56 -0800 ·
quoted from John Tullis
On 3/26/2015 9:17 AM, John Tullis wrote:
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.
It wouldn't be hard to make your 'tag' be of the form:
   "dnsreg:[hour]"

You could then bbhostgrep for the tag, and only query those hosts whose tagged hour aligns with the current hour. You could then schedule your job to run every hour and control the query rate by editing the bb-hosts file.

-- 
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Enterprise Technology Services
Department of Administration
State of Alaska
list John Tullis · Thu, 26 Mar 2015 17:46:43 +0000 ·
Cool! So my hosts file would look something like this?
 0.0.0.0         domain1.com # NOCONN dnsreg:10
0.0.0.0         domain2.com # NOCONN dnsreg:11
0.0.0.0         domain3.com # NOCONN dnsreg:12
0.0.0.0         domain4.com # NOCONN dnsreg:16
0.0.0.0         domain5.com # NOCONN dnsreg:20

John Tullis
quoted from John Thurston


-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of John Thurston
Sent: Thursday, March 26, 2015 11:33 AM
To: xymon at xymon.com
Subject: Re: [Xymon] Run Single Test

On 3/26/2015 9:17 AM, John Tullis wrote:
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.
It wouldn't be hard to make your 'tag' be of the form:
   "dnsreg:[hour]"

You could then bbhostgrep for the tag, and only query those hosts whose tagged hour aligns with the current hour. You could then schedule your job to run every hour and control the query rate by editing the bb-hosts file.

-- 
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Enterprise Technology Services
Department of Administration
State of Alaska
list John Thurston · Thu, 26 Mar 2015 09:56:01 -0800 ·
quoted from John Tullis
On 3/26/2015 9:46 AM, John Tullis wrote:
Cool! So my hosts file would look something like this?

0.0.0.0         domain1.com # NOCONN dnsreg:10
0.0.0.0         domain2.com # NOCONN dnsreg:11
0.0.0.0         domain3.com # NOCONN dnsreg:12
0.0.0.0         domain4.com # NOCONN dnsreg:16
0.0.0.0         domain5.com # NOCONN dnsreg:20
Yes. But it won't do anything useful unless you also modify dnsreg.sh to consume those numeric suffixes.

You might try some lines like:

HOUR=`/usr/bin/date +%H`
/usr/lib/hobbit/server/bin/bbhostgrep "dnsreg:$HOUR" | while read L

I don't know what OS or shell you are using. But the idea is to make your bbhostgrep match only the correctly tagged lines. I use Solaris so I get the number of the current hour with /usr/bin/date. You might use some other utility or parameter.

Another way to do it is to leave the bbhostsgrep line alone and put a conditional inside the 'do'. But that is going to depend on what fields have been returned in L  I don't know how bbhostsgrep differs from xymongrep, so I'll have to leave that as an exercise for the reader.
quoted from John Tullis


-- 
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Enterprise Technology Services
Department of Administration
State of Alaska
list John Tullis · Mon, 30 Mar 2015 13:58:32 +0000 ·
If I want to fire off an update of a test for a single host, what in this command am I missing?

This is what I've tried so far:
bbcmd bbtest-net domain.org.dnsreg
bbcmd bbtest-net domain.org dnsreg

It doesn't update and I can't seem to figure out any better command to run to get it to run. 
Thanks,
quoted from John Tullis

John Tullis


-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of John Tullis
Sent: Thursday, March 26, 2015 11:47 AM
To: John Thurston; xymon at xymon.com
Subject: Re: [Xymon] Run Single Test

Cool! So my hosts file would look something like this?
 0.0.0.0         domain1.com # NOCONN dnsreg:10
0.0.0.0         domain2.com # NOCONN dnsreg:11
0.0.0.0         domain3.com # NOCONN dnsreg:12
0.0.0.0         domain4.com # NOCONN dnsreg:16
0.0.0.0         domain5.com # NOCONN dnsreg:20

John Tullis


-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of John Thurston
Sent: Thursday, March 26, 2015 11:33 AM
To: xymon at xymon.com
Subject: Re: [Xymon] Run Single Test

On 3/26/2015 9:17 AM, John Tullis wrote:
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.
It wouldn't be hard to make your 'tag' be of the form:
   "dnsreg:[hour]"

You could then bbhostgrep for the tag, and only query those hosts whose tagged hour aligns with the current hour. You could then schedule your job to run every hour and control the query rate by editing the bb-hosts file.

-- 
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Enterprise Technology Services
Department of Administration
State of Alaska
list John Thurston · Tue, 31 Mar 2015 10:51:00 -0800 ·
quoted from John Tullis
On 3/30/2015 5:58 AM, John Tullis wrote:
If I want to fire off an update of a test for a single host, what in this command am I missing?

This is what I've tried so far:
bbcmd bbtest-net domain.org.dnsreg
bbcmd bbtest-net domain.org dnsreg

It doesn't update and I can't seem to figure out any better command to run to get it to run.
If 'bbcmd' is the utility used to setup the environment variables, then you could simplify your troubleshooting process by using it to launch a shell.

Something like:
  bbcmd sh

After that has run, you have an instance of 'sh' running with all of the Big Brother environment variables set. This could be confirmed by using the command:
   echo $BBSERVERHOSTNAME

 From that shell, you could then hammer out the correct syntax and debug
your specific script (bbtest-net). With that figured out, you can take that back and try it directly with 'bbcmd'.
quoted from John Tullis

-- 
    Do things because you should, not just because you can.

John Thurston    XXX-XXX-XXXX
user-ce4d79d99bab@xymon.invalid
Enterprise Technology Services
Department of Administration
State of Alaska