If you want to test the net link (the syntax will differ on Windoze) :
my @a=`ping -s 1024 $servertotest -c 10`;
Then some parsing (wonderful regexes) could give you the round trip time and packet loss
which could be a good way to test connectivity between your script and the 3 servers...
Now you'll probably have to get the servers load too, to
make the best choice.
UPDATE :
Here is the parsing code for my box (it's "ping output dependant" ;-)
$a[$#a-1]=~/.*?(\d+)%.*/; # Get the Packet loss near the %
my $pl=$1;
my $rtt=(split'/',(split'=',$a[$#a])[1])[1]; # get the average Round
+trip time
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.