fluent-diagtool 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -14
- data/README.md +6 -6
- data/lib/fluent/diagtool/collectutils.rb +13 -9
- data/lib/fluent/diagtool/diagutils.rb +35 -17
- data/lib/fluent/diagtool/version.rb +1 -1
- data/lib/fluent/diagtool/windows/collectutils.rb +8 -0
- data/lib/fluent/diagtool/windows/diagutils.rb +4 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f767598bf5753ebc1ce4834843a5612d606b0d4d4ac5be26c6538d8d0f7db8fb
|
4
|
+
data.tar.gz: 93cef94976209e28812ab6ca5d466efcdc80c438222477e013d2bc365d8c8cae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b45ed8576c82a0d7f772c516127ac66d03d0a2d1051cb34a663e2062c3fb2e27ad8160acba33bf9c7995485d403ae135fc496984a55b05a772d61273ce1aca0
|
7
|
+
data.tar.gz: 2af458d2e1202db45ebe0ddf6e6ab4e75dec2e9f53b995712ce20836a372af86588ddc5e7bb705c947a12c50673c35b8378f55ebb5c0615625c30f789112de95
|
data/Gemfile.lock
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fluent-diagtool (1.0.
|
4
|
+
fluent-diagtool (1.0.4)
|
5
5
|
fileutils
|
6
6
|
json
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
diff-lcs (1.
|
11
|
+
diff-lcs (1.5.1)
|
12
12
|
fileutils (1.7.2)
|
13
|
-
json (2.
|
13
|
+
json (2.7.1)
|
14
14
|
rake (12.3.3)
|
15
|
-
rspec (3.
|
16
|
-
rspec-core (~> 3.
|
17
|
-
rspec-expectations (~> 3.
|
18
|
-
rspec-mocks (~> 3.
|
19
|
-
rspec-core (3.
|
20
|
-
rspec-support (~> 3.
|
21
|
-
rspec-expectations (3.
|
15
|
+
rspec (3.13.0)
|
16
|
+
rspec-core (~> 3.13.0)
|
17
|
+
rspec-expectations (~> 3.13.0)
|
18
|
+
rspec-mocks (~> 3.13.0)
|
19
|
+
rspec-core (3.13.0)
|
20
|
+
rspec-support (~> 3.13.0)
|
21
|
+
rspec-expectations (3.13.0)
|
22
22
|
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
-
rspec-support (~> 3.
|
24
|
-
rspec-mocks (3.
|
23
|
+
rspec-support (~> 3.13.0)
|
24
|
+
rspec-mocks (3.13.0)
|
25
25
|
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
-
rspec-support (~> 3.
|
27
|
-
rspec-support (3.
|
26
|
+
rspec-support (~> 3.13.0)
|
27
|
+
rspec-support (3.13.1)
|
28
28
|
|
29
29
|
PLATFORMS
|
30
30
|
ruby
|
data/README.md
CHANGED
@@ -32,9 +32,9 @@ https://docs.fluentd.org/quickstart/td-agent-v2-vs-v3-vs-v4
|
|
32
32
|
When you are using td-agent, you can install Diagtool easily with "/usr/sbin/td-agent-gem" command.
|
33
33
|
```
|
34
34
|
# /usr/sbin/td-agent-gem install fluent-diagtool
|
35
|
-
Successfully installed fluent-diagtool-1.0.
|
36
|
-
Parsing documentation for fluent-diagtool-1.0.
|
37
|
-
Installing ri documentation for fluent-diagtool-1.0.
|
35
|
+
Successfully installed fluent-diagtool-1.0.4
|
36
|
+
Parsing documentation for fluent-diagtool-1.0.4
|
37
|
+
Installing ri documentation for fluent-diagtool-1.0.4
|
38
38
|
Done installing documentation for fluent-diagtool after 0 seconds
|
39
39
|
1 gem installed
|
40
40
|
```
|
@@ -43,9 +43,9 @@ When using /usr/sbin/td-agent-gem command, fluent-diagtool is installed under "/
|
|
43
43
|
Otherwise, you can install Diagtool with common gem command. In this case, Ruby version higher than 2.3 might be required to install.
|
44
44
|
```
|
45
45
|
# gem install fluent-diagtool
|
46
|
-
Successfully installed fluent-diagtool-1.0.
|
47
|
-
Parsing documentation for fluent-diagtool-1.0.
|
48
|
-
Installing ri documentation for fluent-diagtool-1.0.
|
46
|
+
Successfully installed fluent-diagtool-1.0.4
|
47
|
+
Parsing documentation for fluent-diagtool-1.0.4
|
48
|
+
Installing ri documentation for fluent-diagtool-1.0.4
|
49
49
|
Done installing documentation for fluent-diagtool after 0 seconds
|
50
50
|
1 gem installed
|
51
51
|
```
|
@@ -157,10 +157,11 @@ module Diagtool
|
|
157
157
|
|
158
158
|
def _find_fluentbit_info()
|
159
159
|
### check if the td-agent-bit is run as daemon
|
160
|
-
|
160
|
+
|
161
|
+
stdout, _stderr, status = Open3.capture3("systemctl cat #{@service_name}")
|
161
162
|
if status.success?
|
162
163
|
if @precheck == false # SKip if precheck is true
|
163
|
-
File.open(@outdir+
|
164
|
+
File.open(@outdir+"/#{@service_name}_env.output", 'w') do |f|
|
164
165
|
f.puts(stdout)
|
165
166
|
end
|
166
167
|
end
|
@@ -184,8 +185,8 @@ module Diagtool
|
|
184
185
|
end
|
185
186
|
end
|
186
187
|
else
|
187
|
-
### check if the td-agent-bit is not run as daemon or run FluentdBit with customized script
|
188
|
-
stdout,
|
188
|
+
### check if the td-agent-bit is not run as daemon or run FluentdBit with customized script
|
189
|
+
stdout, _stderr, status = Open3.capture3('ps aux | grep fluent-bit | grep -v ".*\(grep\|diagtool\)"')
|
189
190
|
if status.success?
|
190
191
|
i = 0
|
191
192
|
stdout.split().each do | line |
|
@@ -419,12 +420,15 @@ module Diagtool
|
|
419
420
|
end
|
420
421
|
end
|
421
422
|
|
423
|
+
def gemfile_path
|
424
|
+
if fluent_package?
|
425
|
+
"/opt/fluent/share/Gemfile"
|
426
|
+
else
|
427
|
+
"/opt/td-agent/share/Gemfile"
|
428
|
+
end
|
429
|
+
end
|
430
|
+
|
422
431
|
def collect_bundled_plugins
|
423
|
-
gemfile_path = if fluent_package?
|
424
|
-
"/opt/fluent/share/Gemfile"
|
425
|
-
else
|
426
|
-
"/opt/td-agent/share/Gemfile"
|
427
|
-
end
|
428
432
|
File.read(gemfile_path).lines(chomp: true).grep(/\Agem "fluent-plugin-/).collect do |line|
|
429
433
|
gem_name = line[/\Agem "(fluent-plugin-.+?)"/, 1]
|
430
434
|
platforms_option = line[/platforms: (\w+)/, 1]
|
@@ -49,12 +49,22 @@ module Diagtool
|
|
49
49
|
"netstat -plan",
|
50
50
|
"netstat -s",
|
51
51
|
]
|
52
|
-
if
|
53
|
-
|
54
|
-
|
52
|
+
if @conf[:type] == "fluentd"
|
53
|
+
if fluent_package?
|
54
|
+
@conf[:package_name] = "fluent-package"
|
55
|
+
@conf[:service_name] = "fluentd"
|
56
|
+
else
|
57
|
+
@conf[:package_name] = "td-agent"
|
58
|
+
@conf[:service_name] = "td-agent"
|
59
|
+
end
|
55
60
|
else
|
56
|
-
|
57
|
-
|
61
|
+
if fluentbit_package?
|
62
|
+
@conf[:package_name] = "fluent-bit"
|
63
|
+
@conf[:service_name] = "fluent-bit"
|
64
|
+
else
|
65
|
+
@conf[:package_name] = "td-agent-bit"
|
66
|
+
@conf[:service_name] = "td-agent-bit"
|
67
|
+
end
|
58
68
|
end
|
59
69
|
end
|
60
70
|
|
@@ -139,19 +149,23 @@ module Diagtool
|
|
139
149
|
tdconf = c.collect_tdconf()
|
140
150
|
diaglogger_info("[Collect] config file is stored in #{tdconf}")
|
141
151
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
152
|
+
case @conf[:type]
|
153
|
+
when 'fluentd'
|
154
|
+
diaglogger_info("[Collect] Collecting #{@conf[:package_name]} gem information...")
|
155
|
+
tdgem = c.collect_tdgems()
|
156
|
+
diaglogger_info("[Collect] #{@conf[:package_name]} gem information is stored in #{tdgem}")
|
157
|
+
gem_info = c.collect_manually_installed_gems(tdgem)
|
158
|
+
diaglogger_info("[Collect] #{@conf[:package_name]} gem information (bundled by default) is stored in #{gem_info[:bundled]}")
|
159
|
+
diaglogger_info("[Collect] #{@conf[:package_name]} manually installed gem information is stored in #{gem_info[:local]}")
|
160
|
+
local_gems = File.read(gem_info[:local]).lines(chomp: true)
|
161
|
+
unless local_gems == [""]
|
162
|
+
diaglogger_info("[Collect] #{@conf[:package_name]} manually installed gems:")
|
163
|
+
local_gems.each do |gem|
|
164
|
+
diaglogger_info("[Collect] * #{gem}")
|
165
|
+
end
|
154
166
|
end
|
167
|
+
when 'fluentbit'
|
168
|
+
# nothing to do!
|
155
169
|
end
|
156
170
|
|
157
171
|
diaglogger_info("[Collect] Collecting config file of OS log...")
|
@@ -351,5 +365,9 @@ module Diagtool
|
|
351
365
|
def fluent_package?
|
352
366
|
File.exist?("/etc/fluent/fluentd.conf") || File.exist?("/opt/fluent/bin/fluentd")
|
353
367
|
end
|
368
|
+
|
369
|
+
def fluentbit_package?
|
370
|
+
File.exist?("/etc/fluent-bit/fluent-bit.conf") || File.exist?("/opt/fluent-bit/bin/fluent-bit")
|
371
|
+
end
|
354
372
|
end
|
355
373
|
end
|
@@ -29,6 +29,14 @@ module Diagtool
|
|
29
29
|
# Not supported yet.
|
30
30
|
return {}
|
31
31
|
end
|
32
|
+
|
33
|
+
def gemfile_path
|
34
|
+
if fluent_package?
|
35
|
+
File.join(ENV["FLUENT_PACKAGE_TOPDIR"], "share/Gemfile")
|
36
|
+
else
|
37
|
+
File.join(ENV["TD_AGENT_TOPDIR"], "share/Gemfile")
|
38
|
+
end
|
39
|
+
end
|
32
40
|
end
|
33
41
|
end
|
34
42
|
end
|
@@ -21,6 +21,10 @@ require 'fluent/diagtool/collectutils'
|
|
21
21
|
module Diagtool
|
22
22
|
module Windows
|
23
23
|
module PlatformSpecificDiagUtils
|
24
|
+
def fluent_package?
|
25
|
+
ENV.key?("FLUENT_PACKAGE_TOPDIR")
|
26
|
+
end
|
27
|
+
|
24
28
|
def run_precheck()
|
25
29
|
raise "[Precheck] Precheck feature is not supported on Windows."
|
26
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-diagtool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kubotat
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fileutils
|
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
89
|
requirements: []
|
90
|
-
rubygems_version: 3.
|
90
|
+
rubygems_version: 3.4.19
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: Diagnostic Tool for Fluentd
|