Hello,
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
<%=h firewall.host_up(firewall.ip4_addr) %>
host_up is in the model rb script as
def host_up(ip4_addr)
require “ping.rb”
ping_obj =
Ping.pingecho(ip4_addr,timeout=5,service=“echo”)
if ping_obj == false
is_up = “Down”
end
if ping_obj == true
is_up = “UP”
end
ret_value ="device " + ip4_addr + " is "+ is_up
return ret_value
end
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.
Ray
–
Ray Ward
Ward Technologies, LLC
[email protected]
630 544-2999