Class: Appstats::Host

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/appstats/host.rb

Class Method Summary collapse

Class Method Details

.update_hostsObject



8
9
10
11
12
13
14
15
16
# File 'lib/appstats/host.rb', line 8

def self.update_hosts
  sql = "select distinct(host) from appstats_log_collectors where host not in (select name from appstats_hosts)"
  count = 0
  Appstats.connection.execute(sql).each do |row| 
    Appstats::Host.create(:name => row[0], :status => 'derived')
    count += 1
  end
  count
end