Sha256: 7a8618fdfaca7b5d61433b3da2986026e78bd23004b306e2c2a62525e22630b9
Contents?: true
Size: 829 Bytes
Versions: 2
Compression:
Stored size: 829 Bytes
Contents
class Fluent::PushoverOutput < Fluent::Output Fluent::Plugin.register_output('pushover', self) config_param :account_token, :string config_param :user_key, :string PUSHOVER_ENDPOINT = 'https://api.pushover.net/1/messages.json' # Define `log` method for v0.10.42 or earlier unless method_defined?(:log) define_method("log") { $log } end def initialize super require 'uri' require 'net/http' end def configure(conf) super end def emit(tag, es, chain) es.each do |time, record| send(record) end chain.next end def send(message) begin response = Net::HTTP.post_form(URI.parse(PUSHOVER_ENDPOINT), {'token' => @account_token, 'user' => @user_key, 'message' => message}) rescue => e log.error "Pushover error: #{e.message}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-pushover-1.0.0 | lib/fluent/plugin/out_pushover.rb |
fluent-plugin-pushover-0.0.4 | lib/fluent/plugin/out_pushover.rb |