reacter 0.0.7 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,7 +34,7 @@ class Reacter
34
34
  # implement: send a message suitable for consumption by an instance of reacter
35
35
  # in listen mode
36
36
  def send(message, format=nil)
37
- false
37
+ raise "Send not implemented"
38
38
  end
39
39
 
40
40
  # implement: poll for a new message and return it
@@ -0,0 +1,22 @@
1
+ #------------------------------------------------------------------------------#
2
+ # FilterAgent
3
+ #
4
+ require 'reacter/agent'
5
+
6
+ class Reacter
7
+ class FilterAgent < Agent
8
+ def received(message)
9
+ if @config['sources']
10
+ sources = @config['sources'].keys()
11
+
12
+ # fall through if neither default nor our host specifically is named
13
+ return false unless (@config['sources'].include?('default') or @config['sources'].include?(message.source))
14
+
15
+ # fall through if the metric is not in either default our the current source's filter
16
+ return false unless (@config['sources']['default'].include?(message.metric) or @config['sources'][message.source].include?(message.metric))
17
+ end
18
+
19
+ return message
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,39 @@
1
+ #------------------------------------------------------------------------------#
2
+ # RunnerAgent
3
+ #
4
+ require 'reacter/agent'
5
+
6
+ class Reacter
7
+ class RunnerAgent < Agent
8
+ def received(message)
9
+ general = (Reacter[%W{agents decider sources any #{message.metric}}] || {})
10
+ specific = (Reacter[%W{agents decider sources #{message.source} #{message.metric}}] || {}) if message.source
11
+ decider_config = specific.deep_merge!(general)
12
+
13
+ unless decider_config.empty?
14
+ actions = [*decider_config.get('actions.exec', [])]
15
+
16
+ actions.each do |action|
17
+ if action.is_a?(String)
18
+ action = {
19
+ 'command' => action
20
+ }
21
+ end
22
+
23
+ xenv = action.get('environment', {}).collect{|k,v|
24
+ ["REACTER_#{k.upcase}", v]
25
+ }
26
+
27
+ message.to_h.reject{|k,v| k.to_sym == :raw }.each_recurse{|k,v,path|
28
+ xenv << ["REACTER_#{path.collect{|i| i.upcase }.join('_')}", v.to_s]
29
+ }
30
+ xenv = Hash[xenv]
31
+
32
+ puts xenv.inspect
33
+ end
34
+ end
35
+
36
+ return message
37
+ end
38
+ end
39
+ end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reacter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Gary Hetzel
@@ -12,46 +13,48 @@ date: 2013-03-18 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: eventmachine
15
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &20751620 !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :runtime
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
24
+ version_requirements: *20751620
27
25
  - !ruby/object:Gem::Dependency
28
26
  name: deep_merge
29
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &20750220 !ruby/object:Gem::Requirement
28
+ none: false
30
29
  requirements:
31
- - - '>='
30
+ - - ! '>='
32
31
  - !ruby/object:Gem::Version
33
32
  version: '0'
34
33
  type: :runtime
35
34
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
35
+ version_requirements: *20750220
41
36
  - !ruby/object:Gem::Dependency
42
37
  name: hashlib
43
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &20748940 !ruby/object:Gem::Requirement
39
+ none: false
44
40
  requirements:
45
- - - '>='
41
+ - - ! '>='
46
42
  - !ruby/object:Gem::Version
47
43
  version: '0'
48
44
  type: :runtime
49
45
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
46
+ version_requirements: *20748940
47
+ - !ruby/object:Gem::Dependency
48
+ name: hiredis
49
+ requirement: &20748020 !ruby/object:Gem::Requirement
50
+ none: false
51
51
  requirements:
52
- - - '>='
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *20748020
55
58
  description: A utility for consuming, transforming, and routing monitoring data from
56
59
  various sources
57
60
  email: ghetzel@outbrain.com
@@ -66,8 +69,10 @@ files:
66
69
  - lib/reacter/adapters/file.rb
67
70
  - lib/reacter/agent.rb
68
71
  - lib/reacter/agents/decider.rb
72
+ - lib/reacter/agents/filter.rb
69
73
  - lib/reacter/agents/logger.rb
70
74
  - lib/reacter/agents/relay.rb
75
+ - lib/reacter/agents/runner.rb
71
76
  - lib/reacter/config.rb
72
77
  - lib/reacter/core.rb
73
78
  - lib/reacter/message.rb
@@ -80,25 +85,26 @@ files:
80
85
  - bin/reacter
81
86
  homepage: http://outbrain.github.com/reacter/
82
87
  licenses: []
83
- metadata: {}
84
88
  post_install_message:
85
89
  rdoc_options: []
86
90
  require_paths:
87
91
  - lib
88
92
  required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
89
94
  requirements:
90
- - - '>='
95
+ - - ! '>='
91
96
  - !ruby/object:Gem::Version
92
97
  version: '0'
93
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
94
100
  requirements:
95
- - - '>='
101
+ - - ! '>='
96
102
  - !ruby/object:Gem::Version
97
103
  version: '0'
98
104
  requirements: []
99
105
  rubyforge_project:
100
- rubygems_version: 2.0.0
106
+ rubygems_version: 1.8.11
101
107
  signing_key:
102
- specification_version: 4
108
+ specification_version: 3
103
109
  summary: Reacter monitoring processor
104
110
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 698f0acf6a91c8a8f222c2b5a9c794a9649b1b9f
4
- data.tar.gz: df4407d0644729a0f432e9dba966caa10fc30a27
5
- SHA512:
6
- metadata.gz: 9db488df26691082e2ef23d48675359075856e68a0936a803175ddf177508ea2f53fb4046eb49f35468733f45bb8ce412c7fdb864b0d116a8ea57152bd85deb8
7
- data.tar.gz: f7478402230db72f05b0d8cfd91585a13aeb832d1c795e33669f0d4b7b40b23c842107cd8cd91ba02cd953f7e4385b2809fd246b10d931ed7f28bb9a51bb764d