Class: Fluent::PushoverOutput
- Inherits:
-
Output
- Object
- Output
- Fluent::PushoverOutput
- Defined in:
- lib/fluent/plugin/out_pushover.rb
Constant Summary collapse
- PUSHOVER_ENDPOINT =
'https://api.pushover.net/1/messages.json'
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #emit(tag, es, chain) ⇒ Object
-
#initialize ⇒ PushoverOutput
constructor
A new instance of PushoverOutput.
- #send(message) ⇒ Object
Constructor Details
#initialize ⇒ PushoverOutput
Returns a new instance of PushoverOutput.
14 15 16 17 18 |
# File 'lib/fluent/plugin/out_pushover.rb', line 14 def initialize super require 'uri' require 'net/http' end |
Instance Method Details
#configure(conf) ⇒ Object
20 21 22 23 |
# File 'lib/fluent/plugin/out_pushover.rb', line 20 def configure(conf) super end |
#emit(tag, es, chain) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/fluent/plugin/out_pushover.rb', line 25 def emit(tag, es, chain) es.each do |time, record| send(record) end chain.next end |
#send(message) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/fluent/plugin/out_pushover.rb', line 33 def send() begin response = Net::HTTP.post_form(URI.parse(PUSHOVER_ENDPOINT), {'token' => @account_token, 'user' => @user_key, 'message' => }) rescue => e log.error "Pushover error: #{e.}" end end |