PingPoller2

Tue May 19 21:44:00 EDT 2009

This is a basic 'ping' poller that executes java.net.InetAddress.isReachable(). This tests whether that address is reachable. A best effort is made by the Java implementation to try to reach the host, but firewalls and server configuration may block requests resulting in a unreachable status while some specific ports may be accessible. A typical implementation will use ICMP ECHO REQUESTs if the privilege can be obtained, otherwise it will try to establish a TCP connection on port 7 (Echo) of the destination host. Note that the exact implementation is dependent on the Java vendor, version, and operating system.

You specify a list of IP addresses or host names to test. Each address is periodically tested, resulting in an XML-formatted events:

<ping target="goodhost" response="true">
<ping target="badhost" response="false">

You can optionally specify the grace period "timeout" (number of milliseconds) for each address to reply. The default is "3000" (3-seconds).

You can also specify a "poll.interval.minutes" to control how often the polling repeats. The default is "1" (1-minute).

This is a two-threaded 'ping' poller. It will ping a list of hosts, one at a time, and then repeat, trying to honor the "poll.interval.minutes" property if possible (if the previous poll returned with time to spare). Since failed pings will block the main poller thread for the full "timeout" period, the main thread will move any failed target to a secondary thread for subsequent checks. This secondary thread contains only failed targets. It is expected that they may be unavailable for some period of time anyway, and any extra delay in discovering their return to availability on this secondary thread is less critical than reliably detecting when a target fails in a timely manner via the main thread.

As a rule of thumb, you should try to keep [#hosts]*[averagePingDelay] < [poll.interval.millis]*60000, otherwise the polling interval may become longer than expected.

Since the average ping delay for reachable hosts is usually small (< 100-milliseconds), this poller should be able to safely handle 600 or more targets, per instance, for an interval of 1-minute. For more targets, you could increase the interval or use the "PingPollerX" multi-threaded poller. You should use the poller version that just fits your needs, in order to optimize use of your server resources.

Errors

Errors (i.e. exceptions) are recorded as XML-formatted events:
<ping target="goodhost" cause="java.net.ConnectException: No route to host">
<ping target="badhost" cause="java.net.ConnectException: No route to host">