Sha256: ba81d4f252bd0631f3fb11b7796461785dd88a3cee29744eeb369c4afced20a4

Contents?: true

Size: 472 Bytes

Versions: 14

Compression:

Stored size: 472 Bytes

Contents

require 'json'
require 'frontkick'
require 'shellwords'

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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
alerty-0.4.0 lib/alerty/plugin/exec.rb
alerty-0.3.0 lib/alerty/plugin/exec.rb
alerty-0.2.3 lib/alerty/plugin/exec.rb
alerty-0.2.2 lib/alerty/plugin/exec.rb
alerty-0.2.1 lib/alerty/plugin/exec.rb
alerty-0.2.0 lib/alerty/plugin/exec.rb
alerty-0.1.1 lib/alerty/plugin/exec.rb
alerty-0.1.0 lib/alerty/plugin/exec.rb
alerty-0.0.9 lib/alerty/plugin/exec.rb
alerty-0.0.8 lib/alerty/plugin/exec.rb
alerty-0.0.7 lib/alerty/plugin/exec.rb
alerty-0.0.6 lib/alerty/plugin/exec.rb
alerty-0.0.5 lib/alerty/plugin/exec.rb
alerty-0.0.4 lib/alerty/plugin/exec.rb