fluent-plugin-td-monitoring 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +5 -0
- data/VERSION +1 -1
- data/fluent-plugin-td-monitoring.gemspec +1 -1
- data/lib/fluent/plugin/in_td_monitor_agent.rb +2 -6
- data/lib/fluent/plugin/{fms_fluentd_ext.rb → tdms_ext_fluentd.rb} +71 -34
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1df66e714b08d9ff41981893194707794a761c06
|
4
|
+
data.tar.gz: a15c5f5044e29bb570c9c9c3dfbd5e677da01e5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b05bc8792642c72b3b492aabbfce44ca9adfc684799be02658abc1d720f2ed4e989b3734ba023c3d7884274266a862120d6c4204798cdf676c089c8fdaeeb76
|
7
|
+
data.tar.gz: 81c7cee93fd3ec7d40c58a4ff3f3277e11c09ad5f6022631ae4311dbd123f45f50a7631e9ad3b98dd4f9f2c3abef3e3bbfa6c3ff67128f8c02824fadc1cad20d
|
data/ChangeLog
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.has_rdoc = false
|
16
16
|
gem.required_ruby_version = '>= 1.9.2'
|
17
17
|
|
18
|
-
gem.add_dependency "fluentd", "
|
18
|
+
gem.add_dependency "fluentd", ">= 0.10.33"
|
19
19
|
gem.add_dependency "ohai", "~> 6.20.0"
|
20
20
|
gem.add_dependency "httpclient", "~> 2.4.0"
|
21
21
|
gem.add_development_dependency "rake", ">= 0.9.2"
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Fluent
|
2
|
-
require_relative '
|
2
|
+
require_relative 'tdms_ext_fluentd'
|
3
3
|
require_relative 'out_td_counter'
|
4
4
|
|
5
5
|
class TDMonitorAgentInput < Input
|
6
|
-
VERSION = "0.
|
6
|
+
VERSION = "0.2.0"
|
7
7
|
|
8
8
|
Plugin.register_input('td_monitor_agent', self)
|
9
9
|
|
@@ -204,10 +204,6 @@ module Fluent
|
|
204
204
|
tagged_counts
|
205
205
|
end
|
206
206
|
|
207
|
-
def has_metric?(plugin)
|
208
|
-
plugin['output_plugin'] && plugin.has_key?('buffer_queue_length')
|
209
|
-
end
|
210
|
-
|
211
207
|
def send_to_tdms(path, info)
|
212
208
|
#puts JSON.pretty_generate('agent_id' => @agent_id, 'data' => info, 'time' => Time.now.to_i); return true
|
213
209
|
begin
|
@@ -28,27 +28,30 @@ module Fluent
|
|
28
28
|
'buffer_queue_length' => '@buffer.queue_size',
|
29
29
|
'buffer_queued_size' => '@buffer.total_queued_chunk_size',
|
30
30
|
'emit_count' => '@emit_count',
|
31
|
-
'retry_count' => '@
|
31
|
+
'retry_count' => '@num_errors'
|
32
32
|
}
|
33
33
|
|
34
34
|
def get_monitor_info(pe, opts = {})
|
35
|
-
obj = {'plugin_id' => pe.id_or_tag_path}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
v = pe.instance_eval(code)
|
41
|
-
unless v.nil?
|
42
|
-
conf[key] = v
|
43
|
-
end
|
44
|
-
rescue
|
45
|
-
end
|
35
|
+
obj = {'plugin_id'.freeze => pe.id_or_tag_path}
|
36
|
+
conf = {
|
37
|
+
'type'.freeze => pe.config['@type'.freeze] || pe.config['type'.freeze],
|
38
|
+
'output_plugin'.freeze => pe.is_a?(::Fluent::Output),
|
39
|
+
'plugin_category'.freeze => plugin_category(pe)
|
46
40
|
}
|
47
|
-
obj['config'] = conf
|
48
41
|
|
49
|
-
if
|
42
|
+
if pe.is_a?(BufferedOutput)
|
43
|
+
TD_MONITOR_INFO.each_pair { |key, code|
|
44
|
+
begin
|
45
|
+
v = pe.instance_eval(code)
|
46
|
+
unless v.nil?
|
47
|
+
conf[key] = v
|
48
|
+
end
|
49
|
+
rescue
|
50
|
+
end
|
51
|
+
}
|
50
52
|
obj['metrics'] = get_plugin_metric(pe)
|
51
53
|
end
|
54
|
+
obj['config'] = conf
|
52
55
|
|
53
56
|
obj
|
54
57
|
end
|
@@ -84,32 +87,66 @@ module Fluent
|
|
84
87
|
end
|
85
88
|
end
|
86
89
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
+
if defined?(::Fluent::EventRouter) # for v0.12 or later
|
91
|
+
class EngineClass
|
92
|
+
def set_tag_path(prefix = '')
|
93
|
+
rules = @root_agent.event_router.instance_variable_get(:@match_rules)
|
94
|
+
set_tag_path_in_rules(prefix, rules)
|
90
95
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
+
labels = @root_agent.labels
|
97
|
+
labels.each { |n, label|
|
98
|
+
rules = label.event_router.instance_variable_get(:@match_rules)
|
99
|
+
set_tag_path_in_rules("#{prefix}/#{n}", rules)
|
100
|
+
}
|
101
|
+
end
|
96
102
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
103
|
+
def set_tag_path_in_rules(prefix, rules)
|
104
|
+
rules.each { |rule|
|
105
|
+
tag_path = "#{prefix}/#{rule.pattern_str}"
|
106
|
+
collector = rule.collector
|
107
|
+
if collector.is_a?(Output)
|
108
|
+
collector.tag_path = tag_path
|
109
|
+
if collector.is_a?(MultiOutput) && collector.respond_to?(:outputs)
|
110
|
+
set_tag_path_to_multi_output(tag_path, collector)
|
111
|
+
end
|
112
|
+
if collector.respond_to?(:output) && collector.output.is_a?(Output)
|
113
|
+
set_tag_path_to_wrap_output(tag_path, collector)
|
114
|
+
end
|
105
115
|
end
|
106
|
-
|
107
|
-
|
116
|
+
}
|
117
|
+
end
|
118
|
+
end
|
119
|
+
else # for v0.10
|
120
|
+
class Match
|
121
|
+
alias orig_init initialize
|
122
|
+
attr_reader :pattern_str
|
123
|
+
|
124
|
+
def initialize(pattern_str, output)
|
125
|
+
@pattern_str = pattern_str.dup
|
126
|
+
orig_init(pattern_str, output)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
class EngineClass
|
131
|
+
def set_tag_path(prefix = '')
|
132
|
+
@matches.each { |m|
|
133
|
+
if m.is_a?(Match)
|
134
|
+
tag_path = "#{prefix}/#{m.pattern_str}"
|
135
|
+
m.output.tag_path = tag_path
|
136
|
+
if m.output.is_a?(MultiOutput) && m.output.respond_to?(:outputs)
|
137
|
+
set_tag_path_to_multi_output(tag_path, m.output)
|
138
|
+
end
|
139
|
+
if m.output.respond_to?(:output) && m.output.output.is_a?(Output)
|
140
|
+
set_tag_path_to_wrap_output(tag_path, m.output)
|
141
|
+
end
|
108
142
|
end
|
109
|
-
|
110
|
-
|
143
|
+
}
|
144
|
+
end
|
111
145
|
end
|
146
|
+
end
|
112
147
|
|
148
|
+
# Helper methods for tag setting
|
149
|
+
class EngineClass
|
113
150
|
def set_tag_path_to_multi_output(prefix, multi_output)
|
114
151
|
new_prefix = "#{prefix}/#{get_type_from_klass(multi_output.class)}"
|
115
152
|
multi_output.outputs.each_with_index { |output, index|
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-td-monitoring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Nakagawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.10.33
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.10.33
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -108,9 +108,9 @@ files:
|
|
108
108
|
- VERSION
|
109
109
|
- data/ca-bundle.crt
|
110
110
|
- fluent-plugin-td-monitoring.gemspec
|
111
|
-
- lib/fluent/plugin/fms_fluentd_ext.rb
|
112
111
|
- lib/fluent/plugin/in_td_monitor_agent.rb
|
113
112
|
- lib/fluent/plugin/out_td_counter.rb
|
113
|
+
- lib/fluent/plugin/tdms_ext_fluentd.rb
|
114
114
|
homepage: http://www.treasuredata.com/
|
115
115
|
licenses:
|
116
116
|
- MIT
|