fluent-plugin-growl 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +1 -0
- data/ChangeLog +2 -0
- data/README +31 -0
- data/Rakefile +32 -0
- data/VERSION +1 -0
- data/lib/fluent/plugin/out_growl.rb +61 -0
- metadata +98 -0
data/AUTHORS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
TAKEI Yuya <takei.yuya AT gmail.com>
|
data/ChangeLog
ADDED
data/README
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Growl Notification Output Plugin
|
2
|
+
|
3
|
+
First, you must set up growl can "Listen for incoming notifications" at "Growl" in "System Preferences".
|
4
|
+
|
5
|
+
fluent.conf example:
|
6
|
+
=====
|
7
|
+
<match growl.**>
|
8
|
+
type growl
|
9
|
+
|
10
|
+
server localhost
|
11
|
+
#password fluent
|
12
|
+
appname Fluent Growl Notify
|
13
|
+
|
14
|
+
<notify>
|
15
|
+
name Notify
|
16
|
+
priority 0
|
17
|
+
sticky false
|
18
|
+
</notify>
|
19
|
+
|
20
|
+
<notify>
|
21
|
+
name StickyNotify
|
22
|
+
priority 0
|
23
|
+
sticky true
|
24
|
+
</notify>
|
25
|
+
</match>
|
26
|
+
=====
|
27
|
+
|
28
|
+
and some command line example
|
29
|
+
$ echo '{"title": "Title", "message": "Hello World!!"}' | fluent-cat growl.test
|
30
|
+
$ echo '{"title": "Sticky", "message": "It's sticky message!!", notify:"StickyNotify"}' | fluent-cat growl.test
|
31
|
+
$ echo '{}' | fluent-cat growl.test
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/clean'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'jeweler'
|
7
|
+
Jeweler::Tasks.new {|gemspec|
|
8
|
+
gemspec.name = "fluent-plugin-growl"
|
9
|
+
gemspec.summary = "Growl output plugin for Fluent Event Collector"
|
10
|
+
gemspec.author = "TAKEI Yuya"
|
11
|
+
gemspec.email = "takei.yuya@gmail.com"
|
12
|
+
gemspec.homepage = "https://github.com/takei-yuya/fluent-plugin-growl"
|
13
|
+
gemspec.has_rdoc = false
|
14
|
+
gemspec.require_paths = ["lib"]
|
15
|
+
gemspec.add_dependency "fluent", "~> 0.9.14"
|
16
|
+
gemspec.add_dependency "ruby-growl", "~> 3.0"
|
17
|
+
gemspec.test_files = Dir["test/**/*.rb"]
|
18
|
+
gemspec.files = Dir["bin/**/*", "lib/**/*", "test/**/*.rb"] + %w[VERSION AUTHORS Rakefile]
|
19
|
+
gemspec.executables = []
|
20
|
+
}
|
21
|
+
Jeweler::GemcutterTasks.new
|
22
|
+
rescue LoadError
|
23
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
24
|
+
end
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) {|t|
|
27
|
+
t.test_files = Dir['test/*_test.rb']
|
28
|
+
t.ruby_opts = ['-rubygems'] if defined? Gem
|
29
|
+
t.ruby_opts << '-I.'
|
30
|
+
}
|
31
|
+
|
32
|
+
task :default => [:build]
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# vim: set tw=0 sw=2 sts=2 ts=2 :
|
2
|
+
|
3
|
+
module Fluent
|
4
|
+
require 'rubygems'
|
5
|
+
require 'ruby-growl'
|
6
|
+
|
7
|
+
class GrowlOutput < Output
|
8
|
+
Plugin.register_output('growl', self);
|
9
|
+
|
10
|
+
DEFAULT_SERVER = "localhost"
|
11
|
+
DEFAULT_PASSWORD = nil
|
12
|
+
DEFAULT_APPNAME = "Fluent Growl Notification"
|
13
|
+
DEFAULT_NOTIFICATION_NAME = "Fluent Defalt Notification"
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@growl
|
17
|
+
end
|
18
|
+
|
19
|
+
def configure(conf)
|
20
|
+
server = conf['server'] || DEFAULT_SERVER
|
21
|
+
password = conf['password'] || DEFAULT_PASSWORD
|
22
|
+
appname = conf['appname'] || DEFAULT_APPNAME
|
23
|
+
|
24
|
+
@notifies = {}
|
25
|
+
conf.elements.select{|e|
|
26
|
+
e.name = "notify"
|
27
|
+
}.each{|e|
|
28
|
+
name = e['name']
|
29
|
+
unless name
|
30
|
+
raise ConfigError, "Missing 'name' parameter on <notify> directive"
|
31
|
+
end
|
32
|
+
priority = e['priority'].to_i
|
33
|
+
sticky = (e.has_key? "sticky") && (e["sticky"].match /y(es)?|on|true/i ) && true
|
34
|
+
@notifies[name] = {:priority => priority, :sticky => sticky}
|
35
|
+
}
|
36
|
+
# if @notifies.empty?
|
37
|
+
# raise ConfigError, "At least one <notify> directive is needed"
|
38
|
+
# end
|
39
|
+
@notifies[DEFAULT_NOTIFICATION_NAME] = {:priority => 0, :sticky => false}
|
40
|
+
|
41
|
+
@growl = Growl.new server, appname, @notifies.keys, nil, password
|
42
|
+
end
|
43
|
+
|
44
|
+
def emit(tag, es, chain)
|
45
|
+
es.each{|e|
|
46
|
+
title = e.record["title"] || "Fluent Notification"
|
47
|
+
message = e.record["message"] || "#{e.record.to_json} at #{Time.at(e.time).localtime}"
|
48
|
+
notifyname = e.record["notify"] || DEFAULT_NOTIFICATION_NAME
|
49
|
+
notify = @notifies[notifyname]
|
50
|
+
unless notify
|
51
|
+
# TODO: ConfigError?
|
52
|
+
raise ConfigError, "Unknown notify name '#{notifyname}'"
|
53
|
+
end
|
54
|
+
|
55
|
+
@growl.notify notifyname, title, message, notify[:priority], notify[:sticky]
|
56
|
+
}
|
57
|
+
chain.next
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-growl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- TAKEI Yuya
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2011-09-30 00:00:00 +09:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: fluent
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
- 9
|
31
|
+
- 14
|
32
|
+
version: 0.9.14
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: ruby-growl
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 3
|
45
|
+
- 0
|
46
|
+
version: "3.0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id002
|
49
|
+
description:
|
50
|
+
email: takei.yuya@gmail.com
|
51
|
+
executables: []
|
52
|
+
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files:
|
56
|
+
- ChangeLog
|
57
|
+
- README
|
58
|
+
files:
|
59
|
+
- AUTHORS
|
60
|
+
- Rakefile
|
61
|
+
- VERSION
|
62
|
+
- lib/fluent/plugin/out_growl.rb
|
63
|
+
- ChangeLog
|
64
|
+
- README
|
65
|
+
has_rdoc: true
|
66
|
+
homepage: https://github.com/takei-yuya/fluent-plugin-growl
|
67
|
+
licenses: []
|
68
|
+
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
version: "0"
|
90
|
+
requirements: []
|
91
|
+
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 1.3.7
|
94
|
+
signing_key:
|
95
|
+
specification_version: 3
|
96
|
+
summary: Growl output plugin for Fluent Event Collector
|
97
|
+
test_files: []
|
98
|
+
|