Method: Elesai::Action::Check#initialize

Defined in:
lib/elesai/action/check.rb

#initialize(arguments, options) ⇒ Check

Returns a new instance of Check.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/elesai/action/check.rb', line 11

def initialize(arguments,options)
  @options = options.merge!({ :monitor => :nagios, :mode => :active, :diskcachepolicy => nil })
  @arguments = []
  @lsi = nil

  opts = OptionParser.new
  opts.banner = "Usage: #{ID} [options] check [check_options]"
  opts.separator ""
  opts.separator "Check Options"
  opts.on('--hotspare MIN',                      Integer,              "Minimum number of hotspares")                       { |o| @options[:hotspare]        = o }
  opts.on('--diskcachepolicy DISKCACHEPOLICY',   String,               "Disk cache policy/Disk Write Cache checks")         { |o| @options[:diskcachepolicy] = o }
  opts.on('-M', '--monitor [nagios]',            [:nagios],            "Monitoring system")                                 { |o| @options[:monitor]         = o }
  opts.on('-m', '--mode [active|passive]',       [:active, :passive],  "Monitoring mode")                                   { |o| @options[:mode]            = o }
  opts.on('-H', '--nsca_hostname HOSTNAME',      String,               "NSCA hostname to send passive checks")              { |o| @options[:nsca_hostame]    = o }
  opts.on('-c', '--config CONFIG',               String,               "Path to Senedsa (send_nsca) configuration" )        { |o| @options[:senedsa_config]  = o }
  opts.on('-S', '--svc_descr SVC_DESR',          String,               "Nagios service description")                        { |o| @options[:svc_descr]       = o }
  opts.order!(arguments)

  options_valid?
end