Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "rubygems"
- require "activerecord"
- require "csv"
- require "ping"
- ActiveRecord::Base.establish_connection(
- :adapter => "mysql",
- :host => "na",
- :username => "na",
- :password => "na",
- :database => "pc_inventory")
- class Computer < ActiveRecord::Base
- end
- def online(host)
- Ping.pingecho(host, 1.3, 3389)
- end
- def dameware(host)
- Ping.pingecho(host, 0.8, 6129)
- end
- Computer.find(:all, :order => "date DESC").each do |computer|
- online_check = online(computer.ip)
- dameware_check = dameware(computer.ip)
- Computer.update(computer.id, {:online => online_check, :dameware => dameware_check})
- end
- ERROR I get when I run the .rb file...
- online.rb:17: undefined method `online' for main:Object (NoMethodError)
Add Comment
Please, Sign In to add comment