Class: Sensu::Mutator

Inherits:
Object
  • Object
show all
Includes:
Mixlib::CLI, Plugin::Utils
Defined in:
lib/sensu-mutator.rb

Constant Summary collapse

@@autorun =

This works just like Plugin::CLI’s autorun.

self

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Plugin::Utils

#config_files, #deep_merge, #load_config, #net_http_req_class, #read_event, #settings

Constructor Details

#initialize(argv = ARGV) ⇒ Mutator

Returns a new instance of Mutator.



40
41
42
43
# File 'lib/sensu-mutator.rb', line 40

def initialize(argv = ARGV)
  super()
  self.argv = parse_options(argv)
end

Instance Attribute Details

#argvObject

Returns the value of attribute argv.



38
39
40
# File 'lib/sensu-mutator.rb', line 38

def argv
  @argv
end

Class Method Details

.disable_autorunObject



64
65
66
# File 'lib/sensu-mutator.rb', line 64

def self.disable_autorun
  @@autorun = false
end

.method_added(name) ⇒ Object



57
58
59
60
61
# File 'lib/sensu-mutator.rb', line 57

def method_added(name)
  if name == :mutate
    @@autorun = self
  end
end

Instance Method Details

#dumpObject



50
51
52
# File 'lib/sensu-mutator.rb', line 50

def dump
  puts JSON.dump(@event)
end

#mutateObject



45
46
47
48
# File 'lib/sensu-mutator.rb', line 45

def mutate
  ## Override this, be sure any changes are made to @event
  nil
end