Class: Alerty::Plugin::Exec

Inherits:
Object
  • Object
show all
Defined in:
lib/alerty/plugin/exec.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Exec

Returns a new instance of Exec.

Raises:



8
9
10
11
# File 'lib/alerty/plugin/exec.rb', line 8

def initialize(config)
  raise ConfigError.new("exec: command is not configured") unless config.command
  @command = config.command
end

Instance Method Details

#alert(record) ⇒ Object



13
14
15
16
# File 'lib/alerty/plugin/exec.rb', line 13

def alert(record)
  Alerty.logger.info "exec: echo #{record.to_json.shellescape} | #{@command}"
  Frontkick.exec("echo #{record.to_json.shellescape} | #{@command}")
end