ntq_tools 0.7.2 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/app/controllers/ntq_tools/monitors_controller.rb +1 -1
- data/lib/generators/ntq_tools/graphql_scaffold_generator.rb +2 -2
- data/lib/generators/templates/ntq_tools.rb +2 -0
- data/lib/ntq_tools/monitor.rb +14 -3
- data/lib/ntq_tools/monitors/base.rb +1 -1
- data/lib/ntq_tools/monitors/configuration.rb +15 -0
- data/lib/ntq_tools/monitors/sidekiq.rb +13 -7
- data/lib/ntq_tools/version.rb +1 -1
- data/lib/ntq_tools.rb +3 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9a6423facf8642edbfb60c8e40feb6ce68d3ebbdcba52c3677df5e7a154f3ad
|
4
|
+
data.tar.gz: b239adf65c0b94498e36a23cbeb13377b2767856352964e216f49d4454f4ef6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac007f1cf19c09875bbdebc547ffe9d48e5c73f849771e09232e4ec14a1344e9b23da1dd702898f99c87bc3a35a7570cbee81eb5c0d6929b40d077fe7809902a
|
7
|
+
data.tar.gz: d7f97a1da8afbda1ca27d6a2022258c913c59ad5bde214d37ca571458dcf60aab7802735f8bac882ef85a4c0315aa1d1f5134d8fbb7eed319a561cf6cfbc2374
|
data/README.md
CHANGED
@@ -12,6 +12,13 @@ MONITORING_PASSWORD
|
|
12
12
|
MONITORING_USERNAME
|
13
13
|
```
|
14
14
|
|
15
|
+
Vous pouvez également désactiver certains services manuellement
|
16
|
+
```ruby
|
17
|
+
NtqTools::Monitor.configure do |config|
|
18
|
+
config.sidekiq = false
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
15
22
|
## Installation
|
16
23
|
Add this line to your application's Gemfile:
|
17
24
|
|
@@ -9,7 +9,7 @@ module NtqTools
|
|
9
9
|
|
10
10
|
respond_to do |format|
|
11
11
|
format.json do
|
12
|
-
render json: { status: @status, services_status: @services_status }, status: @status == :ok ? :ok : :service_unavailable
|
12
|
+
render json: { status: @status, services_status: @services_status, container_version: ENV['CONTAINER_VERSION'] }, status: @status == :ok ? :ok : :service_unavailable
|
13
13
|
end
|
14
14
|
format.html do
|
15
15
|
end
|
@@ -239,7 +239,7 @@ FILE
|
|
239
239
|
if defined?(Interactor)
|
240
240
|
create_file "app/interactors/#{plural_name}/search_#{plural_name}.rb", <<-FILE
|
241
241
|
module #{context_name}
|
242
|
-
class Search#{
|
242
|
+
class Search#{plural_name.camelcase}
|
243
243
|
include Interactor::Organizer
|
244
244
|
|
245
245
|
organize Get#{plural_name.camelcase}, PaginateRecords
|
@@ -249,7 +249,7 @@ end
|
|
249
249
|
|
250
250
|
create_file "app/interactors/#{plural_name}/get_#{plural_name}.rb", <<-FILE
|
251
251
|
module #{context_name}
|
252
|
-
class Get#{
|
252
|
+
class Get#{plural_name.camelcase}
|
253
253
|
include Interactor
|
254
254
|
|
255
255
|
def call
|
data/lib/ntq_tools/monitor.rb
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
require 'ntq_tools/monitors/redis'
|
2
2
|
require 'ntq_tools/monitors/database'
|
3
3
|
require 'ntq_tools/monitors/sidekiq'
|
4
|
+
require 'ntq_tools/monitors/configuration'
|
4
5
|
|
5
6
|
module NtqTools
|
6
7
|
class Monitor
|
7
8
|
|
9
|
+
def self.configure
|
10
|
+
yield config
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.config
|
14
|
+
@config ||= ::NtqTools::Monitors::Configuration.new
|
15
|
+
end
|
16
|
+
|
8
17
|
# Check if installed services are running, it return a tuple with the status and the services status
|
9
18
|
#
|
10
19
|
# eg: [:ok, [{name: 'redis', status: 'OK'}, {name: 'database', status: 'OK'}]]
|
@@ -14,6 +23,8 @@ module NtqTools
|
|
14
23
|
def self.check
|
15
24
|
services_status = []
|
16
25
|
list.each do |monitor|
|
26
|
+
# skip si le service est désactivé (false) dans la config
|
27
|
+
next if config.respond_to?(monitor.name) && !config.send(monitor.name)
|
17
28
|
next unless monitor.is_installed?
|
18
29
|
|
19
30
|
services_status << {
|
@@ -24,14 +35,14 @@ module NtqTools
|
|
24
35
|
status = services_status.all? { |service| service[:status] == 'OK' } ? :ok : :error
|
25
36
|
[status, services_status]
|
26
37
|
end
|
27
|
-
|
38
|
+
|
28
39
|
def self.list
|
40
|
+
# ATTENTION - Rajouter le nom du nouveau service (:name) dans la class Configuration (attr_accessor)
|
29
41
|
[
|
30
42
|
::NtqTools::Monitors::Redis,
|
31
43
|
::NtqTools::Monitors::Database,
|
32
44
|
::NtqTools::Monitors::Sidekiq
|
33
45
|
]
|
34
46
|
end
|
35
|
-
|
36
47
|
end
|
37
|
-
end
|
48
|
+
end
|
@@ -1,22 +1,28 @@
|
|
1
1
|
require 'ntq_tools/monitors/base'
|
2
|
+
|
2
3
|
module NtqTools
|
3
4
|
module Monitors
|
4
5
|
class Sidekiq < Base
|
5
|
-
|
6
|
+
|
6
7
|
class << self
|
7
8
|
def name
|
8
|
-
|
9
|
+
'sidekiq'
|
9
10
|
end
|
10
|
-
|
11
|
+
|
11
12
|
def is_installed?
|
12
|
-
::Gem.loaded_specs.has_key?(
|
13
|
+
::Gem.loaded_specs.has_key?('sidekiq')
|
13
14
|
end
|
14
|
-
|
15
|
+
|
15
16
|
def check
|
17
|
+
require 'sidekiq/api'
|
16
18
|
::Sidekiq::ProcessSet.new.any? { |process| process['busy'] }
|
19
|
+
rescue LoadError
|
20
|
+
raise LoadError, <<-ERROR
|
21
|
+
::Sidekiq::ProcessSet could not be loaded by gem ntq_tools.
|
22
|
+
It is required for Sidekiq monitoring'
|
23
|
+
ERROR
|
17
24
|
end
|
18
25
|
end
|
19
|
-
|
20
26
|
end
|
21
27
|
end
|
22
|
-
end
|
28
|
+
end
|
data/lib/ntq_tools/version.rb
CHANGED
data/lib/ntq_tools.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ntq_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/ntq_tools/engine.rb
|
74
74
|
- lib/ntq_tools/monitor.rb
|
75
75
|
- lib/ntq_tools/monitors/base.rb
|
76
|
+
- lib/ntq_tools/monitors/configuration.rb
|
76
77
|
- lib/ntq_tools/monitors/database.rb
|
77
78
|
- lib/ntq_tools/monitors/redis.rb
|
78
79
|
- lib/ntq_tools/monitors/sidekiq.rb
|