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.)

Attachment: signature.asc
Description: Digital signature

Reply via email to