Module: OkComputer
- Defined in:
- lib/ok_computer/registry.rb,
lib/ok_computer/check.rb,
lib/ok_computer/engine.rb,
lib/ok_computer/version.rb,
lib/ok_computer/configuration.rb,
lib/ok_computer/check_collection.rb,
lib/ok_computer/built_in_checks/http_check.rb,
lib/ok_computer/built_in_checks/solr_check.rb,
lib/ok_computer/built_in_checks/cache_check.rb,
lib/ok_computer/built_in_checks/neo4j_check.rb,
lib/ok_computer/built_in_checks/redis_check.rb,
lib/ok_computer/built_in_checks/default_check.rb,
lib/ok_computer/built_in_checks/mongoid_check.rb,
lib/ok_computer/built_in_checks/rabbitmq_check.rb,
lib/ok_computer/built_in_checks/app_version_check.rb,
lib/ok_computer/built_in_checks/resque_down_check.rb,
app/controllers/ok_computer/ok_computer_controller.rb,
lib/ok_computer/built_in_checks/ruby_version_check.rb,
lib/ok_computer/built_in_checks/active_record_check.rb,
lib/ok_computer/built_in_checks/elasticsearch_check.rb,
lib/ok_computer/built_in_checks/generic_cache_check.rb,
lib/ok_computer/built_in_checks/size_threshold_check.rb,
lib/ok_computer/built_in_checks/sidekiq_latency_check.rb,
lib/ok_computer/built_in_checks/resque_backed_up_check.rb,
lib/ok_computer/built_in_checks/mongoid_replica_set_check.rb,
lib/ok_computer/built_in_checks/delayed_job_backed_up_check.rb,
lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb
Overview
Private: Storage of the checks which have been registered with OkComputer.
No one is expected to interact directly with this class, but rather through the outer OkComputer interface.
Defined Under Namespace
Classes: ActiveRecordCheck, AppVersionCheck, CacheCheck, Check, CheckCollection, DefaultCheck, DelayedJobBackedUpCheck, ElasticsearchCheck, Engine, GenericCacheCheck, HttpCheck, MongoidCheck, MongoidReplicaSetCheck, Neo4jCheck, OkComputerController, RabbitmqCheck, RedisCheck, Registry, ResqueBackedUpCheck, ResqueDownCheck, ResqueFailureThresholdCheck, RubyVersionCheck, SidekiqLatencyCheck, SizeThresholdCheck, SolrCheck
Constant Summary collapse
- VERSION =
'1.7.3'
Class Attribute Summary collapse
-
.analytics_ignore ⇒ Object
Public: Option to disable third-party app performance tools (.e.g NewRelic) from counting OkComputer routes towards their total.
-
.check_in_parallel ⇒ Object
Public: whether to execute checks in parallel.
-
.mount_at ⇒ Object
Public: The route to automatically mount the OkComputer engine.
-
.options ⇒ Object
Private: The options container.
-
.password ⇒ Object
Private: The password for access to checks.
-
.username ⇒ Object
Private: The username for access to checks.
Class Method Summary collapse
-
.authenticate(username_try, password_try) ⇒ Object
Public: Attempt to authenticate against required username and password.
-
.require_authentication(username, password, options = {}) ⇒ Object
Public: Configure HTTP Basic authentication.
-
.requires_authentication?(params = {}) ⇒ Boolean
Public: Whether OkComputer is configured to require authentication.
-
.whitelist ⇒ Object
# Private: Configure a whitelist of checks to skip authentication.
Class Attribute Details
.analytics_ignore ⇒ Object
Public: Option to disable third-party app performance tools (.e.g NewRelic) from counting OkComputer routes towards their total.
52 53 54 |
# File 'lib/ok_computer/configuration.rb', line 52 def analytics_ignore @analytics_ignore end |
.check_in_parallel ⇒ Object
Public: whether to execute checks in parallel.
49 50 51 |
# File 'lib/ok_computer/configuration.rb', line 49 def check_in_parallel @check_in_parallel end |
.mount_at ⇒ Object
Public: The route to automatically mount the OkComputer engine. Setting to false prevents OkComputer from automatically mounting itself.
46 47 48 |
# File 'lib/ok_computer/configuration.rb', line 46 def mount_at @mount_at end |
.options ⇒ Object
Private: The options container
61 62 63 |
# File 'lib/ok_computer/configuration.rb', line 61 def @options end |
.password ⇒ Object
Private: The password for access to checks
58 59 60 |
# File 'lib/ok_computer/configuration.rb', line 58 def password @password end |
.username ⇒ Object
Private: The username for access to checks
55 56 57 |
# File 'lib/ok_computer/configuration.rb', line 55 def username @username end |
Class Method Details
.authenticate(username_try, password_try) ⇒ Object
Public: Attempt to authenticate against required username and password
username - Username to authenticate with password - Password to authenticate with
Returns a Boolean
28 29 30 31 32 |
# File 'lib/ok_computer/configuration.rb', line 28 def self.authenticate(username_try, password_try) return true unless requires_authentication? username == username_try && password == password_try end |
.require_authentication(username, password, options = {}) ⇒ Object
Public: Configure HTTP Basic authentication
username - Username required to view checks password - Password required to view checks options - Hash of additional options
- except - Array of checks to skip authentication for
Examples:
OkComputer.require_authentication("foo", "bar")
# => Require authentication with foo:bar for all checks
OkComputer.require_authentication("foo", "bar", except: %w(default nonsecret))
# => Require authentication with foo:bar for all checks except the checks named "default" and "nonsecret"
16 17 18 19 20 |
# File 'lib/ok_computer/configuration.rb', line 16 def self.require_authentication(username, password, = {}) self.username = username self.password = password self. = end |
.requires_authentication?(params = {}) ⇒ Boolean
Public: Whether OkComputer is configured to require authentication
Returns a Boolean
37 38 39 40 41 |
# File 'lib/ok_computer/configuration.rb', line 37 def self.requires_authentication?(params={}) return false if params[:action] == "show" && whitelist.include?(params[:check]) username && password end |
.whitelist ⇒ Object
# Private: Configure a whitelist of checks to skip authentication
64 65 66 |
# File 'lib/ok_computer/configuration.rb', line 64 def whitelist .fetch(:except) { [] } end |