lostperls has asked for the wisdom of the Perl Monks concerning the following question:
It is supposed to display the down gif when any one of the variables in brackets i.e ($mx1pop|$mx1imap) is not responding, but if i take one of the servers down, it waits for ages before still displaying the up gif.#!/usr/bin/perl use IO::Socket::INET; $ns1dns = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 53, Proto => 'tcp'); $ns2dns = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 53, Proto => 'tcp'); $ns3dns = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 53, Proto => 'tcp'); $ns4dns = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 53, Proto => 'tcp'); $mx1pop3 = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 995, Proto => 'tcp'); $mx1imap = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 993, Proto => 'tcp'); $mx1smtp = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 25, Proto => 'tcp'); $mx1web = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 80, Proto => 'tcp'); print "Content-type: text/html\n\n"; # Web Services if ($mx1web) { print "<IMG SRC='http://www.xxx.com/images/up.gif' WIDTH=38 HEIGHT=2 +1>"; } else { print "<IMG SRC='http://www.xxx.com/images/down.gif' WIDTH=38 HEIGHT +=21>"; } print "<br>"; # DNS Services if ($ns1dns|$ns2dns|ns3dns|ns4dns) { print "<IMG SRC='http://www.xxx.com/images/up.gif' WIDTH=38 HEIGHT=2 +1>"; } else { print "<IMG SRC='http://www.xxx.com/images/down.gif' WIDTH=38 HEIGHT +=21>"; } print "<br>"; #Mail Services if ($mx1pop3|$mx1imap|mx1smtp) { print "<IMG SRC='http://www.xxx.com/images/up.gif' WIDTH=38 HEIGHT=2 +1>"; } else { print "<IMG SRC='http://www.xxx.com/images/down.gif' WIDTH=38 HEIGHT +=21>"; } print "<br>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Whats wrong with this? & Timeouts
by Ovid (Cardinal) on Sep 09, 2002 at 22:04 UTC | |
by lostperls (Initiate) on Sep 09, 2002 at 22:10 UTC | |
|
Re: Whats wrong with this? & Timeouts
by sauoq (Abbot) on Sep 09, 2002 at 22:26 UTC | |
by lostperls (Initiate) on Sep 09, 2002 at 22:27 UTC | |
by sauoq (Abbot) on Sep 09, 2002 at 22:34 UTC | |
by lostperls (Initiate) on Sep 09, 2002 at 22:36 UTC | |
by sauoq (Abbot) on Sep 09, 2002 at 22:38 UTC |