Module: Diskmon::Runner

Defined in:
lib/diskmon.rb

Constant Summary collapse

CONFIG =
"/usr/local/etc/diskmon.conf"

Class Method Summary collapse

Class Method Details

.agentObject

Agent mode


24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/diskmon.rb', line 24

def self.agent

  cfg = Diskmon::Config.new(CONFIG)
  p cfg if $DEBUG

  raid_ctl = Diskmon::RaidController.new
  raid_ctl.get_all_stats
  m = raid_ctl.serialize

  coll = Diskmon::Collector.new
  send_result = coll.send_report(cfg.collector_url, cfg., cfg.collector_password, m)
  p send_result
end

.serverObject

Server mode


42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/diskmon.rb', line 42

def self.server
  set :port, 7777

  DataMapper::Logger.new($stdout, :debug)
  DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/reports.db")

  $DEBUG = true

  DataMapper.finalize

  Diskmon::HardDiskReport.auto_upgrade!

  Diskmon::ServerApp.run!
end