okcomputer 1.12.0 → 1.13.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37e364f1ba01c9b0870d4ffbcd50eda067955be8
|
4
|
+
data.tar.gz: e48b355fab4c30d2d93b6e7522cfe04fa9fd8896
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 926f7f507821ba687d71819408ed602449ec719c76ff15465cbef8144d7c8069d89dc9afced614c530339e99e4c49d46bb112b45d68ab0c4cbba1825bb6c3999
|
7
|
+
data.tar.gz: 06f15affbb329a66e9ce414c6deb67aa697b0454ce8f4e61535bcc07078f5c7e100588b96a60abff0145613af2d154ad86510b11461daabc875c9b1993ba9deb
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module OkComputer
|
2
|
+
# Verifies if the mail server configured for ActionMailer is responding.
|
3
|
+
class ActionMailerCheck < PingCheck
|
4
|
+
|
5
|
+
attr_accessor :klass, :timeout, :host, :port
|
6
|
+
|
7
|
+
def initialize(klass = ActionMailer::Base, timeout = 5)
|
8
|
+
self.klass = klass
|
9
|
+
self.timeout = timeout
|
10
|
+
host = klass.smtp_settings[:address]
|
11
|
+
port = klass.smtp_settings[:port] || 25
|
12
|
+
super(host, port, timeout)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Public: Return the status of the check
|
16
|
+
def check
|
17
|
+
tcp_socket_request
|
18
|
+
mark_message "#{klass} check to #{host}:#{port} successful"
|
19
|
+
rescue => e
|
20
|
+
mark_message "#{klass} at #{host}:#{port} is not accepting connections: '#{e}'"
|
21
|
+
mark_failure
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module OkComputer
|
2
|
+
# Check if a file system directory exists and has the correct access. This
|
3
|
+
# may prove useful if the application relies on a mounted shared file system.
|
4
|
+
class DirectoryCheck < Check
|
5
|
+
ConnectionFailed = Class.new(StandardError)
|
6
|
+
|
7
|
+
attr_accessor :directory, :writable
|
8
|
+
|
9
|
+
# Public: Initialize a new directory check.
|
10
|
+
#
|
11
|
+
# directory - the path of the directory. Can be relative or absolute.
|
12
|
+
# writable - true if directory should allow writes; false if not.
|
13
|
+
def initialize(directory, writable = true)
|
14
|
+
raise ArgumentError if directory.blank?
|
15
|
+
|
16
|
+
self.directory = directory
|
17
|
+
self.writable = writable
|
18
|
+
end
|
19
|
+
|
20
|
+
# Public: Return the status of the directory check
|
21
|
+
def check
|
22
|
+
stat = File.stat(directory) if File.exist?(directory)
|
23
|
+
if stat
|
24
|
+
if stat.directory?
|
25
|
+
if !stat.readable?
|
26
|
+
mark_message "Directory '#{directory}' is not readable."
|
27
|
+
mark_failure
|
28
|
+
elsif writable && !stat.writable?
|
29
|
+
mark_message "Directory '#{directory}' is not writable."
|
30
|
+
mark_failure
|
31
|
+
elsif !writable && stat.writable?
|
32
|
+
mark_message "Directory '#{directory}' is writable (undesired)."
|
33
|
+
mark_failure
|
34
|
+
else
|
35
|
+
mark_message "Directory '#{directory}' is #{writable ? nil : 'NOT '}writable (as expected)."
|
36
|
+
end
|
37
|
+
else
|
38
|
+
mark_message "'#{directory}' is not a directory."
|
39
|
+
mark_failure
|
40
|
+
end
|
41
|
+
else
|
42
|
+
mark_message "Directory '#{directory}' does not exist."
|
43
|
+
mark_failure
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -8,7 +8,7 @@ module OkComputer
|
|
8
8
|
test_value.tap do |value|
|
9
9
|
Rails.cache.write(cache_key, value)
|
10
10
|
if value == Rails.cache.read(cache_key)
|
11
|
-
mark_message "Able to read and write"
|
11
|
+
mark_message "Able to read and write via #{humanize_cache_store_name}"
|
12
12
|
else
|
13
13
|
mark_failure
|
14
14
|
mark_message "Value read from the cache does not match the value written"
|
@@ -29,5 +29,14 @@ module OkComputer
|
|
29
29
|
def cache_key
|
30
30
|
"ock-generic-cache-check-#{Socket.gethostname}"
|
31
31
|
end
|
32
|
+
|
33
|
+
def humanize_cache_store_name
|
34
|
+
name = if Rails.application.config.cache_store.is_a? Array
|
35
|
+
Rails.application.config.cache_store[0]
|
36
|
+
else
|
37
|
+
Rails.application.config.cache_store
|
38
|
+
end
|
39
|
+
name.to_s.humanize
|
40
|
+
end
|
32
41
|
end
|
33
42
|
end
|
data/lib/ok_computer/version.rb
CHANGED
data/lib/okcomputer.rb
CHANGED
@@ -8,19 +8,21 @@ require "ok_computer/legacy_rails_controller_support"
|
|
8
8
|
# and the built-in checks
|
9
9
|
require "ok_computer/built_in_checks/size_threshold_check"
|
10
10
|
require "ok_computer/built_in_checks/http_check"
|
11
|
+
require "ok_computer/built_in_checks/ping_check"
|
11
12
|
|
13
|
+
require "ok_computer/built_in_checks/action_mailer_check"
|
12
14
|
require "ok_computer/built_in_checks/active_record_check"
|
13
15
|
require "ok_computer/built_in_checks/app_version_check"
|
14
16
|
require "ok_computer/built_in_checks/cache_check"
|
15
17
|
require "ok_computer/built_in_checks/default_check"
|
16
18
|
require "ok_computer/built_in_checks/delayed_job_backed_up_check"
|
19
|
+
require "ok_computer/built_in_checks/directory_check"
|
17
20
|
require "ok_computer/built_in_checks/generic_cache_check"
|
18
21
|
require "ok_computer/built_in_checks/elasticsearch_check"
|
19
22
|
require "ok_computer/built_in_checks/mongoid_check"
|
20
23
|
require "ok_computer/built_in_checks/neo4j_check"
|
21
24
|
require "ok_computer/built_in_checks/mongoid_replica_set_check"
|
22
25
|
require "ok_computer/built_in_checks/optional_check"
|
23
|
-
require "ok_computer/built_in_checks/ping_check"
|
24
26
|
require "ok_computer/built_in_checks/rabbitmq_check"
|
25
27
|
require "ok_computer/built_in_checks/redis_check"
|
26
28
|
require "ok_computer/built_in_checks/resque_backed_up_check"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: okcomputer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Byrne
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-10-
|
13
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sqlite3
|
@@ -72,11 +72,13 @@ files:
|
|
72
72
|
- app/controllers/ok_computer/ok_computer_controller.rb
|
73
73
|
- config/locales/okcomputer.en.yml
|
74
74
|
- config/routes.rb
|
75
|
+
- lib/ok_computer/built_in_checks/action_mailer_check.rb
|
75
76
|
- lib/ok_computer/built_in_checks/active_record_check.rb
|
76
77
|
- lib/ok_computer/built_in_checks/app_version_check.rb
|
77
78
|
- lib/ok_computer/built_in_checks/cache_check.rb
|
78
79
|
- lib/ok_computer/built_in_checks/default_check.rb
|
79
80
|
- lib/ok_computer/built_in_checks/delayed_job_backed_up_check.rb
|
81
|
+
- lib/ok_computer/built_in_checks/directory_check.rb
|
80
82
|
- lib/ok_computer/built_in_checks/elasticsearch_check.rb
|
81
83
|
- lib/ok_computer/built_in_checks/generic_cache_check.rb
|
82
84
|
- lib/ok_computer/built_in_checks/http_check.rb
|