Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
ICMP is not all that it's cracked up to be. There are a number of problems with it, especially when you use it over public networks.

  • It may be routed at a lower priority than other protocols, thus making latency appear worse than it really is.
  • Some system administrators insist on dropping it at the firewall.
  • Some routers may receive an ICMP ping request for a machine on its local net, and on the assumption that it can reach it, will reply itself, rather than sending the packet out on the wire of the localnet and waiting for the response. Call it lazy evaluation if you will. (Disclaimer: I have never observed this myself, but a tech whose word I have no reason to doubt told me that this can happen).

This means that just because you receive a response doesn't mean that the machine is alive, and if you don't receive a packet, it doesn't mean that the machine is dead.

In spite of that, things are not as bad as they seem. When you want to do this sort of thing, you are usually interested in your own LAN, an environment over which you theoretically have some control. So you should be able to determine whether you will encounter these scenarios.

On the other hand, just because you do get a ping response back, doesn't mean that the service you are really interested in (e.g. http, smtp or ssh to name a few) is actually running. Apache might have eaten all your RAM, sendmail might have eaten all your disk, sshd might have run out of sockets...

Therefore, to really test the health of a machine and the ability to reach it successfully (i.e. did a new firewall rule put it out of bounds?) the best way that I have found is to open up socket on the port the service is advertised on, and if successful, close it immediately. As an added benefit, if the open fails, you get a terse explanation of the problem in $!.

I posted a snippet of code recently at Re: is there script to detect if remote machine is alive/reachable w/o using Net::Ping? that shows how this can be done.


print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'

In reply to Re: Server Status Monitor by grinder
in thread Server Status Monitor by xjar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 02:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found