Class: Pandur

Inherits:
Object
  • Object
show all
Includes:
Config
Defined in:
lib/pandur/config.rb,
lib/pandur.rb,
lib/pandur/host.rb,
lib/pandur/check.rb,
lib/pandur/version.rb

Overview

To access configuration (and logging), just include this module to your class, and you can directly access all configuration and the logging.

class ExampleClass
  include Pandur::Config

  def some_method
    logger.debug(config('some_config'))
  end
end

Defined Under Namespace

Modules: Config Classes: Check, Host

Constant Summary collapse

VERSION =
'0.0.2'

Instance Method Summary collapse

Methods included from Config

#config, #load_config, #logger

Constructor Details

#initialize(conf = {}) ⇒ Pandur

Returns a new instance of Pandur.



11
12
13
14
# File 'lib/pandur.rb', line 11

def initialize(conf = {})
  logger.level = conf[:log_level] || Logger::ERROR
  load_config(conf[:config_file] || '~/.pandur.yaml')
end

Instance Method Details

#run(conf = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/pandur.rb', line 16

def run(conf = {})
  logger.debug("running ..")
  config('hosts').each do |host|
    check(host)
  end
  logger.debug(".. finished")
end