I am working on an App and am trying to return a page with the status of a host (up/down). The host IP addresses are taken from a database and then pinged using ping.rb. The code works if typed in irb but when done from inside Rails, it always returns false.
The code is called from list.rhtml by
<h2><%=h firewall.host_up(firewall.ip4_addr) %></h2>
host_up is in the model rb script as
ping_obj = Ping.pingecho(ip4_addr,timeout=5,service="echo")
if ping_obj == false
is_up = "Down"
if ping_obj == true
is_up = "UP"
ret_value ="device " + ip4_addr + " is "+ is_up
The code seems to execute (if a put a breakpoint call in host_up, it gets called) just does not return a true when the host is up. Using tcpdump, I can see that is does not ever actually try to send out packets.
Thanks for any ideas or suggestions you might have.