class OpsviewRest::MonitoringServer

Attributes

opsview[RW]
options[RW]
resource_type[RW]

Public Class Methods

new(opsview, options = {}) click to toggle source
# File lib/opsview_rest/monitoringserver.rb, line 9
def initialize(opsview, options = {})
  @options = {
    name: 'Slave',
    roles: [],
    activated: true,
    monitors: [],
    nodes: [],
    save: true,
    replace: false
  }.update options

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

  @option[:roles] = @option[:roles].map { |x| { 'name' => x } }
  @option[:monitors] = @option[:monitors].map { |x| { 'name' => x } }
  @option[:nodes] = @option[:nodes].map { |x| { 'host' => { 'name' => x } } }
  @options[:activated] = (@options[:activated] ? 1 : 0)

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