Forum: Ruby on Rails Need Help!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
437595de52cf59f7fbd847ccb94492af?d=identicon&s=25 Junior Junior wangsa (vgenjr)
on 2009-04-07 04:31
hi..

i'm new at ruby on rails..
first i have a table with a column named status(this column use to store
a status of an access point ("online" or "offline") after my application
have done pinging the access point)

i use a net-ping library..

how can i update the data in column status "automatically".
---------------------------------------------------------------------------------

can somebody explain this code?

      @nodestat = Node.all.map do |node|{
          :Status => PingExternal.new(node.ipadd)? "Online" : "Offline"}
      end

and why the status always "Online"


Any ideas would be very gratefully received!

Thank You.
A93363196f047ab4a7c4dab02e90091d?d=identicon&s=25 glennswest (Guest)
on 2009-04-07 09:47
(Received via mailing list)
Few things come to mind here.
I've done this exact app before.
I keep my devices in a table. The Rails app just displays the
information
from the table. A background daemon does the actual monitoring.
I get alot more details in my version, including mapping what mac/ip
address are on
which switch port, and using SNMP to the switch to do discovery of
devices.

The moral of this is break you ping into a separate process/task. Then
poll yours AP's
and update there status with ActiveRecord.

If you need some help, I can certainly give you some pointers.

glennswest at yahoo dot com dot sg
http://mentalpagingspace.blogspot.com

On Apr 7, 10:31 am, Junior Junior wangsa <rails-mailing-l...@andreas-
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-04-07 09:53
(Received via mailing list)
On Apr 7, 3:31 am, Junior Junior wangsa <rails-mailing-l...@andreas-
s.net> wrote:

>
> can somebody explain this code?
>
>       @nodestat = Node.all.map do |node|{
>           :Status => PingExternal.new(node.ipadd)? "Online" : "Offline"}
>       end
>

A brief overview of the docs (and general convention) suggests that
PingExternal.new doesn't do a ping, it just creates a pinger object -
all you are testing is whether that new object was nil or not.

Fred
A93363196f047ab4a7c4dab02e90091d?d=identicon&s=25 glennswest (Guest)
on 2009-04-07 10:08
(Received via mailing list)
I've added a blog article of my network scanner.
If you need further help let me know.

http://mentalpagingspace.blogspot.com/2009/04/netw...



On Apr 7, 10:31 am, Junior Junior wangsa <rails-mailing-l...@andreas-
This topic is locked and can not be replied to.