I could add a configuration for the ping command... The issue is with parameters that may vary on different implementations.
I was providing the ping command already as a backup in case isReachable failed. I will think about the IPV6. How I would write a test case for the IPV6? :/ Also, I have been thinking of better names for these configuration options. if anyone has a more obvious name I would appreciate the help. Currently I have: <network-check-NIC> - The network Interface Card name <network-check-period> - The interval in MS <network-check-timeout> - The timeout to fail the ping in Milliseconds <network-check-URL-list> - Similar to checkList, but this will use I may add a <network-check-ping-command>... and maybe use an expression for the parameter. On Tue, Nov 22, 2016 at 8:41 AM, Miroslav Novak <mno...@redhat.com> wrote: > Hi Clebert, > > the idea looks ok. > > Maybe it could be more system agnostic. I think that ping command might not > be present on some OS installations. InetAddress#isReachable(int) works in > best effort mode based on [1] and need some privileges. Do you think it could > be possible to provide some default implementation and allow user to add his > own kind of check of IP addresses. > > Also this should support IPv6 addresses. wdyt? > > Thanks, > Mirek > > [1] > https://docs.oracle.com/javase/8/docs/api/java/net/InetAddress.html#isReachable-int- > > ----- Original Message ----- >> From: "Clebert Suconic" <clebert.suco...@gmail.com> >> To: dev@activemq.apache.org >> Sent: Tuesday, November 22, 2016 2:17:19 AM >> Subject: [DISCUSS] ARTEMIS-863 - Network Health Check >> >> I am implementing a feature that will allow an user to specify a ping >> address list. >> >> >> the broker will ping such list on a given interval, and it will >> shutdown once the list cannot be achieved. >> >> >> For instance, you specify 10.0.0.1, the broker will ping 10.0.0.1 >> every 10 seconds, and if that address is not reachable, it would go >> down. (shutdown). this is to prevent a network isolation, so in case >> you pull out the cable of the server the server will shutdown until >> the network is back. >> >> >> >> There are 4 properties currently implemented: >> >> >> <network-check-list> - IPs to be pinged (or DNS) .. this is simple >> ICMP through Network.isReachable >> >> <network-check-NIC> - The network Interface Card name >> >> <network-check-period> - The interval in MS >> >> <network-check-timeout> - The timeout to fail the ping in Milliseconds >> >> <network-check-URL-list> - Similar to checkList, but this will use >> HTTP open in a similar fashion. >> >> >> >> These will work nicely by setting System properties. (which I will >> further improve by allowing something like ./artemis run >> -Cnetwork-check-list=10.0.0.2) >> >> >> I have already implemented this into a branch which I will send tomorrow as >> PR. >> >> https://github.com/clebertsuconic/activemq-artemis/commits/netcheck >> >> (BTW this link will not be valid for future readers of the list.. on >> that case... just look at the commits on master and look for >> ARTEMIS-863 on the git logs). >> >> >> >> >> >> -- >> Clebert Suconic >> -- Clebert Suconic