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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36f2a315c0601942f4d58cd452f14f070af79e67cbfdf3c87cdbf910678381c2
4
- data.tar.gz: 960056d096bba41112ab9dc3d08a10a8af2693500d79fc8a6b4f4736ccb77d3c
3
+ metadata.gz: f767598bf5753ebc1ce4834843a5612d606b0d4d4ac5be26c6538d8d0f7db8fb
4
+ data.tar.gz: 93cef94976209e28812ab6ca5d466efcdc80c438222477e013d2bc365d8c8cae
5
5
  SHA512:
6
- metadata.gz: ca7a0047228b91ae650ba9db3fb2a9e63589b45a7594a52ab62f59d02110da68b4ec94f11a9e3a6b9f507aa12dba7bf03f1366ab63b7c169805bee0f4304771d
7
- data.tar.gz: a01cc78efb7e024a56619d30fdc959439cb07deccd67dd6f0faa94c026f0a054f2640c2bd796f76012ac8a0887b7ebc6c7d766c997288f3a30f78c6df4061162
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.3)
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.3)
11
+ diff-lcs (1.5.1)
12
12
  fileutils (1.7.2)
13
- json (2.6.3)
13
+ json (2.7.1)
14
14
  rake (12.3.3)
15
- rspec (3.9.0)
16
- rspec-core (~> 3.9.0)
17
- rspec-expectations (~> 3.9.0)
18
- rspec-mocks (~> 3.9.0)
19
- rspec-core (3.9.2)
20
- rspec-support (~> 3.9.3)
21
- rspec-expectations (3.9.2)
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.9.0)
24
- rspec-mocks (3.9.1)
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.9.0)
27
- rspec-support (3.9.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.3
36
- Parsing documentation for fluent-diagtool-1.0.3
37
- Installing ri documentation for fluent-diagtool-1.0.3
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.3
47
- Parsing documentation for fluent-diagtool-1.0.3
48
- Installing ri documentation for fluent-diagtool-1.0.3
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
- stdout, stderr, status = Open3.capture3('systemctl cat td-agent-bit')
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+'/td-agent-bit_env.output', 'w') do |f|
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, stderr, status = Open3.capture3('ps aux | grep fluent-bit | grep -v ".*\(grep\|diagtool\)"')
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 fluent_package?
53
- @conf[:package_name] = "fluent-package"
54
- @conf[:service_name] = "fluentd"
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
- @conf[:package_name] = "td-agent"
57
- @conf[:service_name] = "td-agent"
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
- diaglogger_info("[Collect] Collecting #{@conf[:package_name]} gem information...")
143
- tdgem = c.collect_tdgems()
144
- diaglogger_info("[Collect] #{@conf[:package_name]} gem information is stored in #{tdgem}")
145
-
146
- gem_info = c.collect_manually_installed_gems(tdgem)
147
- diaglogger_info("[Collect] #{@conf[:package_name]} gem information (bundled by default) is stored in #{gem_info[:bundled]}")
148
- diaglogger_info("[Collect] #{@conf[:package_name]} manually installed gem information is stored in #{gem_info[:local]}")
149
- local_gems = File.read(gem_info[:local]).lines(chomp: true)
150
- unless local_gems == [""]
151
- diaglogger_info("[Collect] #{@conf[:package_name]} manually installed gems:")
152
- local_gems.each do |gem|
153
- diaglogger_info("[Collect] * #{gem}")
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
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
2
  module Diagtool
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  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.3
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: 2023-11-22 00:00:00.000000000 Z
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.3.26
90
+ rubygems_version: 3.4.19
91
91
  signing_key:
92
92
  specification_version: 4
93
93
  summary: Diagnostic Tool for Fluentd