BB Unix Network Monitor - Message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: {bb} http://... dynamic URLs



In <s10f9664.059@KTGWEDIST3.KILROYTRAVELS.COM> "Johnny Damtoft" <Johnny.Damtoft@kilroytravels.com> writes:

>Cool - But how should my bb-hosts file look like?
>0.0.0.0 server1.kilroytravels.com # noping 

You don't need to define any test in the bb-hosts entry for
that server, so the above entry would be quite all-right.
The extension script just needs to make sure that the host-
name it reports a status for is listed in bb-hosts - so that
the display-server knows where to put the result on the 
webpages. So if your bb-hosts file has the hostname as
"server1.kilroytravels.com", then the command that sends
in the status-message should use "server1,kilroytravels,com.http"
as the host+test name (note: those are commas instead of dots
in the hostname).

I.e. in my demonstration script, you would change it slightly
to

 # Tell the world about it
 $BB $BBDISP "status server1,kilroytravels,com.http $COLOR `date`


Henrik




>>>> henrik-bb@hswn.dk 02-Aug-04 22:05:45 >>>
>In <s10eab93.056@KTGWEDIST3.KILROYTRAVELS.COM> "Johnny Damtoft"
><Johnny.Damtoft@kilroytravels.com> writes:

>>I have been trying to monitor an URL where the contect of this URL is
>>dynamic.

>>My URL in the bb-hosts looks like this:
>>http://www.kilroytravels.com/servlet/Satellite?pagename=get&cid=1076588865040&SC=DK&uxd=1091469054


>>At the end of this URL you see "uxd=1091469054". This is a timestamp
>>generated from $(date +%s)

>This is the kind of stuff that Big Brother extension scripts are for.

>Using your favourite scripting language (shell, perl, python, ...)
>it should be fairly easy to script retrival of this dynamic URL.
>Say, something along this (completely untested, I'll leave the
>debugging to you):

>  #!/bin/sh

>  # Pick up the BB server defs
>  BBHOME=/usr/local/bb
>  export BBHOME
>  . $BBHOME/etc/bbdef-server.sh

>  COLOR=green   # Be an optimist until we decide otherwise
>  
>  # Generate the URL
>  TIMESTAMP="date +%s"
> 
>URL="http://www.kilroytravels.com/servlet/Satellite?pagename=get&cid=1076588865040&SC=DK&uxd=$TIMESTAMP";

>  # Run the test using bbnet
>  $BBHOME/bin/bbnet "$URL" >/tmp/urltest.out

>  # Now see what result we got
>  if test "$?" != 0
>  then
>     # Oops - something very wrong, flag an error
>     COLOR=red
>     MSG="Could not talk to server"
>  else
>    # Grab the HTTP status 
>    read HTTPVER RC MESSAGE </tmp/urltest.out
>    case $RC in
>     '200'|'401'|'301'|'302')
>        MSG="Web is OK"
>        ;;
>     *)
>        MSG="Error on website"
>        COLOR=red
>        ;;
>    esac
>  fi

>  # Tell the world about it
>  $BB $BBDISP "status www,kilroytravels,com.http $COLOR `date`

>  $MSG

>  `cat /tmp/urltest.out`
>  "

>  exit 0

>Put this script in $BBHOME/ext/, make sure it is executable, and
>put the name of the file into the $BBHOME/etc/bb-bbexttab and
>restart Big Brother.

-- 
Henrik Storner
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=
To unsubscribe from this list, or to subscribe to the bb-digest list
send e-mail to mailto:majordomo@bb4.com with unsubscribe bb -and/or-
subscribe bb-digest in the BODY of the message.


Home | Main Index | Thread Index