BB Unix Network Monitor - Message
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: {bb} http://... dynamic URLs
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.
Regards,
Henrik
--
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