Class: Imperium::ServiceCheck
- Defined in:
- lib/imperium/service_check.rb
Overview
ServiceCheck is a container for data being received from and sent to the agent services and checks apis.
Instance Attribute Summary collapse
-
#deregister_critical_service_after ⇒ String
Specifies that checks associated with a service should deregister after this time.
-
#docker_container_id ⇒ String
Specifies that the check is a Docker check, and Consul will evaluate the script every Interval in the given container using the specified Shell.
-
#headers ⇒ Hash<String => String>
Specifies a set of headers that should be set for HTTP checks.
-
#http ⇒ String
Specifies an HTTP check to perform a GET request against the value of HTTP (expected to be a URL) every Interval.
-
#id ⇒ String
The service’s id, when creating a new check this will be automatically assigned if not supplied, must be unique.
-
#interval ⇒ String
Specifies the frequency at which to run this check.
-
#method ⇒ String
Specifies a different HTTP method to be used for an HTTP check.
-
#name ⇒ String
The check’s name in the consul UI, required for creation, not required to be unique.
-
#notes ⇒ String
Specifies arbitrary information for humans.
-
#script ⇒ String
Specifies a script or path to a script to run on Interval to update the status of the check.
-
#service_id ⇒ String
Specifies the ID of a service to associate the registered check with an existing service provided by the agent.
-
#shell ⇒ String
The shell to use for docker checks, only applies when docker_container_id is specified.
-
#status ⇒ String
Specifies the initial status of the health check.
-
#tcp ⇒ String
Specifies a TCP to connect against the value of TCP (expected to be an IP or hostname plus port combination) every Interval.
- #timeout ⇒ String
-
#tls_skip_verify ⇒ String
Specifies if the certificate for an HTTPS check should not be verified.
-
#ttl ⇒ String
Specifies this is a TTL check, and the TTL endpoint must be used periodically to update the state of the check.
Method Summary
Methods inherited from APIObject
#==, #attribute_map, #initialize, #ruby_attribute_names, #to_h
Constructor Details
This class inherits a constructor from Imperium::APIObject
Instance Attribute Details
#deregister_critical_service_after ⇒ String
Returns Specifies that checks associated with a service should deregister after this time. This is specified as a time duration with suffix like “10m”. If a check is in the critical state for more than this configured value, then its associated service (and all of its associated checks) will automatically be deregistered. The minimum timeout is 1 minute, and the process that reaps critical services runs every 30 seconds, so it may take slightly longer than the configured timeout to trigger the deregistration. This should generally be configured with a timeout that’s much, much longer than any expected recoverable outage for the given service.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#docker_container_id ⇒ String
Returns Specifies that the check is a Docker check, and Consul will evaluate the script every Interval in the given container using the specified Shell. Note that Shell is currently only supported for Docker checks.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#headers ⇒ Hash<String => String>
Returns Specifies a set of headers that should be set for HTTP checks. Each header can have multiple values.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#http ⇒ String
Returns Specifies an HTTP check to perform a GET request against the value of HTTP (expected to be a URL) every Interval. If the response is any 2xx code, the check is passing. If the response is 429 Too Many Requests, the check is warning. Otherwise, the check is critical. HTTP checks also support SSL. By default, a valid SSL certificate is expected. Certificate verification can be controlled using the TLSSkipVerify.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#id ⇒ String
Returns The service’s id, when creating a new check this will be automatically assigned if not supplied, must be unique.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#interval ⇒ String
Returns Specifies the frequency at which to run this check. This is required for HTTP and TCP checks.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#method ⇒ String
Returns Specifies a different HTTP method to be used for an HTTP check. When no value is specified, GET is used.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#name ⇒ String
Returns The check’s name in the consul UI, required for creation, not required to be unique.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#notes ⇒ String
Returns Specifies arbitrary information for humans. This is not used by Consul internally.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#script ⇒ String
Returns Specifies a script or path to a script to run on Interval to update the status of the check. If specifying a path, this path must exist on disk and be readable by the Consul agent.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#service_id ⇒ String
Returns Specifies the ID of a service to associate the registered check with an existing service provided by the agent. Does not need to be set when registering the check at the same time as registering a service.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#shell ⇒ String
Returns The shell to use for docker checks, only applies when docker_container_id is specified.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#status ⇒ String
Returns Specifies the initial status of the health check.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#tcp ⇒ String
Returns Specifies a TCP to connect against the value of TCP (expected to be an IP or hostname plus port combination) every Interval. If the connection attempt is successful, the check is passing. If the connection attempt is unsuccessful, the check is critical. In the case of a hostname that resolves to both IPv4 and IPv6 addresses, an attempt will be made to both addresses, and the first successful connection attempt will result in a successful check.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#timeout ⇒ String
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#tls_skip_verify ⇒ String
Returns Specifies if the certificate for an HTTPS check should not be verified.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |
#ttl ⇒ String
Returns Specifies this is a TTL check, and the TTL endpoint must be used periodically to update the state of the check.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/imperium/service_check.rb', line 79 class ServiceCheck < APIObject self.attribute_map = { 'ID' => :id, 'Name' => :name, 'Script' => :script, 'DockerContainerID' => :docker_container_id, 'Shell' => :shell, 'Interval' => :interval, 'Timeout' => :timeout, 'TTL' => :ttl, 'HTTP' => :http, 'Header' => :headers, 'Method' => :method, 'TCP' => :tcp, 'Status' => :status, 'Notes' => :notes, 'TLSSkipVerify' => :tls_skip_verify, 'DeregisterCriticalServiceAfter' => :deregister_critical_service_after, 'ServiceID' => :service_id, } end |