serf-td-agent 0.0.1 → 0.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +14 -15
- data/bin/serf-td-agent +8 -9
- data/serf-td-agent.gemspec +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 952b4e4179ed81673e740da2829c697bfe8a65d6
|
4
|
+
data.tar.gz: c71b2162b68341a7017a61a8f9c00b03cfb4d1df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14af2d9b29e1d6799658e9db80db8ce11c43c998eee60f63980e38af8302ff979930a5eae5e2d24bde999569931df00c7971b825e94a7db61aba91c26109f4f6
|
7
|
+
data.tar.gz: e32d5979b39a7f62e9c76f169c320844acd46c3639afe30cd71ec70d306cca061298fb973ccd0ed3626693fa5ace0b32b6d61698b7eb00dac45dad03c3015ac2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,43 +4,46 @@ td-agent process management with [serf](http://www.serfdom.io/)
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
Assume you have installed [td-agent](http://docs.fluentd.org/categories/installation).
|
8
|
+
|
9
|
+
Use [fluent-gem](http://docs.fluentd.org/articles/faq#i-installed-td-agent-and-want-to-add-custom-plugins-how-do-i-do-it):
|
8
10
|
|
9
11
|
```
|
10
|
-
gem install serf-td-agent
|
12
|
+
fluent-gem install serf-td-agent
|
11
13
|
```
|
12
14
|
|
13
|
-
The `serf` command is automatically downloaded and bundled into the `bin` directory
|
15
|
+
The `serf` command is automatically downloaded and bundled into the `bin` directory of the gem.
|
16
|
+
Also, `serf-td-agent` command, which is a serf event handler, is located at there. Set the environment variable `PATH` as:
|
14
17
|
|
15
18
|
```
|
16
|
-
export PATH=$(gem path serf-td-agent)/bin:$PATH
|
19
|
+
export PATH=$(fluent-gem path serf-td-agent)/bin:$PATH
|
17
20
|
```
|
18
21
|
|
19
22
|
## How to setup the serf cluster
|
20
23
|
|
21
|
-
Run the first serf at any of hosts
|
24
|
+
Run the first serf at any of hosts running td-agent like:
|
22
25
|
|
23
26
|
```bash
|
24
27
|
$ serf agent -event-handler=serf-td-agent
|
25
28
|
```
|
26
29
|
|
27
|
-
Run later serfs at other hosts
|
30
|
+
Run later serfs at other hosts running td-agent like:
|
28
31
|
|
29
32
|
```bash
|
30
|
-
$ serf agent -join
|
33
|
+
$ serf agent -join={the first serf address} -event-handler=serf-td-agent
|
31
34
|
```
|
32
35
|
|
33
|
-
Hint: `-log-level=debug` option
|
36
|
+
Hint: `-log-level=debug` option would be helpful for debugging.
|
34
37
|
|
35
|
-
## How to
|
38
|
+
## How to restart td-agent via serf
|
36
39
|
|
37
40
|
Send a serf event from any of hosts running the serf like:
|
38
41
|
|
39
42
|
```bash
|
40
|
-
$ serf event td-agent-
|
43
|
+
$ serf event td-agent-restart
|
41
44
|
```
|
42
45
|
|
43
|
-
This will propagate the `
|
46
|
+
This will propagate the `td-agent-restart` event to the entire serf cluster and execute `sudo /etc/init.d/td-agent restart` at all hosts.
|
44
47
|
|
45
48
|
## Available events
|
46
49
|
|
@@ -56,10 +59,6 @@ Following events are available:
|
|
56
59
|
|
57
60
|
which corresponds with /etc/init.d/td-agent command.
|
58
61
|
|
59
|
-
## ToDo
|
60
|
-
|
61
|
-
Use `serf query` for commands which requires responses like `status` and `configtest`.
|
62
|
-
|
63
62
|
## ChangeLog
|
64
63
|
|
65
64
|
See [CHANGELOG.md](CHANGELOG.md) for details.
|
data/bin/serf-td-agent
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
|
3
3
|
INIT_SCRIPT = "/etc/init.d/td-agent"
|
4
4
|
event = ENV['SERF_EVENT']
|
5
|
-
user_event = ENV['SERF_USER_EVENT']
|
5
|
+
user_event = ENV['SERF_USER_EVENT'] || ENV['SERF_QUERY_NAME']
|
6
6
|
td_agent_event = user_event[9..-1] if user_event and user_event.start_with?('td-agent-')
|
7
7
|
|
8
8
|
if ARGV[0] == "-h"
|
9
|
-
puts "Usage: SERF_EVENT=user
|
9
|
+
puts "Usage: SERF_EVENT=user SERF_USER_EVENT={event} #{File.basename($PROGRAM_NAME)}"
|
10
|
+
puts "Usage: SERF_EVENT=query SERF_QUERY_NAME={query} #{File.basename($PROGRAM_NAME)}"
|
10
11
|
puts ""
|
11
|
-
puts "AVAILABLE EVENTS:"
|
12
|
+
puts "AVAILABLE EVENTS|QUERIES:"
|
12
13
|
puts " td-agent-start"
|
13
14
|
puts " td-agent-stop"
|
14
15
|
puts " td-agent-reload"
|
@@ -19,15 +20,13 @@ if ARGV[0] == "-h"
|
|
19
20
|
puts ""
|
20
21
|
puts "WITH SERF:"
|
21
22
|
puts " serf event {event}"
|
23
|
+
puts " serf query {query}"
|
22
24
|
exit 0
|
23
25
|
end
|
24
26
|
|
25
27
|
status = 0
|
26
|
-
case
|
27
|
-
when "
|
28
|
-
|
29
|
-
when "start", "stop", "reload", "restart", "condrestart", "status", "configtest"
|
30
|
-
status = system "sudo #{INIT_SCRIPT} #{td_agent_event}"
|
31
|
-
end
|
28
|
+
case td_agent_event
|
29
|
+
when "start", "stop", "reload", "restart", "condrestart", "status", "configtest"
|
30
|
+
status = system "sudo #{INIT_SCRIPT} #{td_agent_event}"
|
32
31
|
end
|
33
32
|
exit status
|
data/serf-td-agent.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "serf-td-agent"
|
6
|
-
s.version = "0.0
|
6
|
+
s.version = "0.1.0"
|
7
7
|
s.authors = ["Naotoshi Seo"]
|
8
8
|
s.email = ["sonots@gmail.com"]
|
9
9
|
s.homepage = "http://github.com/sonots/serf-td-agent"
|
@@ -15,8 +15,8 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
-
s.require_paths = ["lib"]
|
18
|
+
# s.require_paths = ["lib"]
|
19
19
|
|
20
20
|
s.add_runtime_dependency "gem-path", '~> 0'
|
21
|
-
s.add_development_dependency "rake"
|
21
|
+
s.add_development_dependency "rake", '~> 0'
|
22
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serf-td-agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem-path
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: A td-agent process management with serf
|