Re: Checking URLS across a cluster.

Mark Suter <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
On 2006-04-10, Andy Lester wrote:

> On Apr 10, 2006, at 6:38 AM, J.Slee wrote:
>
> > I expect it just does a DNS lookup on the host portion of the URL
> > provided, and this will just give back the virtual IP address of the
> > cluster.
>
> What I'm hearing you say is that the DNS is round-robin DNS, so that
> there are three possible IP addresses that come back for foo.com.

In that case, Net::DNS could get all three IPs.  It's only when forced
to return a single IP that the local resolver takes the first one in the
list (the DNS server sorts the list round-robin).

Alternatively, there may only be one IP in the DNS, that is, some form
of host-level clustering or load balancer aka layer X switch.  In this
case, knowledge of the separate IPs is local and specific.

What you was is most definitely possible, for example, if the page
http://www.example.org/test/ contained the string "NODE-IS-WORKING",
then the following ought to work:

    for ip in 192.0.2.10 192.0.2.11 192.0.2.12 ; do
	echo -e "GET /test/ HTTP/1.0\nHost: www.example.org\n\n" \
	    | netcat $ip http \
	    | grep -q "NODE-IS-WORKING" \
	    || echo Node $ip is down
    done

This is an ugly shell script hack.  Someone who knows WWW::Mechanize
and/or LWP:: better than I might be able to give hints on how to use
these without this ugly hacking.

This is what Nagios's "check_http" plugin does to check webservers - the
IP and hostname are separate parameters.  Look at http://www.nagios.org/
As full blown monitoring, it might be what you're after.

--
Mark Suter  http://zwitterion.org/ | I have often regretted my
<[email protected]> | speech, never my silence.
mobile 0411 262 316 - gpg 2C71D63D | Xenocrates (396-314 B.C.)
signature.asc (application/pgp-signature, 246 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Visit keyservers or http://zwitterion.org/keys/

iD8DBQFEOmHgRYso2ixx1j0RAm+qAJ9SVMtuWBag2FXaJyBB4fWS+/ETMQCffktm
JYj7lrkxHVsWxGC/RKD+vtc=
=yE1B
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.