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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06034a5521174e358ee6c051be92bf27f013ab39
4
- data.tar.gz: 0cf3acd76461f7941f4f95a7c2cb513c42c9b7e0
3
+ metadata.gz: 952b4e4179ed81673e740da2829c697bfe8a65d6
4
+ data.tar.gz: c71b2162b68341a7017a61a8f9c00b03cfb4d1df
5
5
  SHA512:
6
- metadata.gz: 9e88b9a490c8161935e59c26d216bbb00dd8efc9320c20226d2661fdbd10d3a9ed902bbdea98da65e4a0116e2aa045cdd16b14b81e55b8676c8b4905538b9597
7
- data.tar.gz: 5c3acdd9d6513b4f6b816647b86ff3237f91639b9dfb061964265c329a468219f7c92ba05130c18eaf098aa73a68bd0b0236d6ef6b46184ee253d49f119a79d5
6
+ metadata.gz: 14af2d9b29e1d6799658e9db80db8ce11c43c998eee60f63980e38af8302ff979930a5eae5e2d24bde999569931df00c7971b825e94a7db61aba91c26109f4f6
7
+ data.tar.gz: e32d5979b39a7f62e9c76f169c320844acd46c3639afe30cd71ec70d306cca061298fb973ccd0ed3626693fa5ace0b32b6d61698b7eb00dac45dad03c3015ac2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,3 @@
1
- ## 0.0.1 (2014/05/19)
1
+ ## 0.1.0 (2014/05/22)
2
2
 
3
3
  First version
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
- Use RubyGems:
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. Set the environment variable `PATH` as:
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 to run td-agent like:
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 to run td-agent like:
30
+ Run later serfs at other hosts running td-agent like:
28
31
 
29
32
  ```bash
30
- $ serf agent -join=${the first serf address} -event-handler=serf-td-agent
33
+ $ serf agent -join={the first serf address} -event-handler=serf-td-agent
31
34
  ```
32
35
 
33
- Hint: `-log-level=debug` option should be helpful for debugging.
36
+ Hint: `-log-level=debug` option would be helpful for debugging.
34
37
 
35
- ## How to start td-agent via serf
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-start
43
+ $ serf event td-agent-restart
41
44
  ```
42
45
 
43
- This will propagate the `start` event to the entire serf cluster and execute `sudo /etc/init.d/td-agent start` at all hosts.
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 SERF_USER_EVENT={event} #{$PROGRAM_NAME}"
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 event
27
- when "user"
28
- case td_agent_event
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
@@ -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.1"
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.1
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-19 00:00:00.000000000 Z
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