Class: OpsviewRest::Hostcheckcommand

Inherits:
Object
  • Object
show all
Includes:
Mixin
Defined in:
lib/opsview_rest/hostcheckcommand.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mixin

#resource_path, #save, #to_json

Constructor Details

#initialize(opsview, options = {}) ⇒ Hostcheckcommand

Returns a new instance of Hostcheckcommand.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/opsview_rest/hostcheckcommand.rb', line 9

def initialize(opsview, options = {})
  @options = {
    name: 'ping',
    args: '-H $HOSTADDRESS$ -t 3 -w 500.0,80% -c 1000.0,100%',
    priority: 1,
    plugin: 'check_icmp',
    uncommitted: false,
    save: true,
    replace: false
  }.update options

  @opsview = opsview
  @resource_type = @options[:type]

  @options[:plugin] = { 'name' => @options[:plugin] }
  @options[:uncommitted] = (@options[:uncommitted] ? 1 : 0)

  save(@options[:replace]) if @options[:save]
end

Instance Attribute Details

#opsviewObject

Returns the value of attribute opsview.



7
8
9
# File 'lib/opsview_rest/hostcheckcommand.rb', line 7

def opsview
  @opsview
end

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/opsview_rest/hostcheckcommand.rb', line 7

def options
  @options
end

#resource_typeObject

Returns the value of attribute resource_type.



7
8
9
# File 'lib/opsview_rest/hostcheckcommand.rb', line 7

def resource_type
  @resource_type
end