Class: Imperium::ServiceCheck

Inherits:
APIObject show all
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

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

#argsArray<String>

Returns Specifies command arguments to run to update the status of the check. Prior to Consul 1.0, checks used a single Script field to define the command to run, and would always run in a shell. In Consul 1.0, the Args array was added so that checks can be run without a shell. The Script field is deprecated, and you should include the shell in the Args to run under a shell, eg. “args”: [“sh”, “-c”, “…”].

Returns:

  • (Array<String>)

    Specifies command arguments to run to update the status of the check. Prior to Consul 1.0, checks used a single Script field to define the command to run, and would always run in a shell. In Consul 1.0, the Args array was added so that checks can be run without a shell. The Script field is deprecated, and you should include the shell in the Args to run under a shell, eg. “args”: [“sh”, “-c”, “…”].



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#deregister_critical_service_afterString

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.

Returns:

  • (String)

    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.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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_idString

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.

Returns:

  • (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. Note that Shell is currently only supported for Docker checks.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#headersHash<String => String>

Returns Specifies a set of headers that should be set for HTTP checks. Each header can have multiple values.

Returns:

  • (Hash<String => String>)

    Specifies a set of headers that should be set for HTTP checks. Each header can have multiple values.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#httpString

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.

Returns:

  • (String)

    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.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#idString

Returns The service’s id, when creating a new check this will be automatically assigned if not supplied, must be unique.

Returns:

  • (String)

    The service’s id, when creating a new check this will be automatically assigned if not supplied, must be unique.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#intervalString

Returns Specifies the frequency at which to run this check. This is required for HTTP and TCP checks.

Returns:

  • (String)

    Specifies the frequency at which to run this check. This is required for HTTP and TCP checks.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#methodString

Returns Specifies a different HTTP method to be used for an HTTP check. When no value is specified, GET is used.

Returns:

  • (String)

    Specifies a different HTTP method to be used for an HTTP check. When no value is specified, GET is used.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#nameString

Returns The check’s name in the consul UI, required for creation, not required to be unique.

Returns:

  • (String)

    The check’s name in the consul UI, required for creation, not required to be unique.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#notesString

Returns Specifies arbitrary information for humans. This is not used by Consul internally.

Returns:

  • (String)

    Specifies arbitrary information for humans. This is not used by Consul internally.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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 (deprecated since consul 1.0)(deprecatedsinceconsul1.0) ⇒ 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.

Returns:

  • (String)

    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.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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_idString

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.

Returns:

  • (String)

    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



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#shellString

Returns The shell to use for docker checks, only applies when docker_container_id is specified.

Returns:

  • (String)

    The shell to use for docker checks, only applies when docker_container_id is specified



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#statusString

Returns Specifies the initial status of the health check.

Returns:

  • (String)

    Specifies the initial status of the health check.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#tcpString

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.

Returns:

  • (String)

    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.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#timeoutString

Returns:

  • (String)


87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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_verifyString

Returns Specifies if the certificate for an HTTPS check should not be verified.

Returns:

  • (String)

    Specifies if the certificate for an HTTPS check should not be verified.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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

#ttlString

Returns Specifies this is a TTL check, and the TTL endpoint must be used periodically to update the state of the check.

Returns:

  • (String)

    Specifies this is a TTL check, and the TTL endpoint must be used periodically to update the state of the check.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/imperium/service_check.rb', line 87

class ServiceCheck < APIObject
  self.attribute_map = {
    'ID' => :id,
    'Name' => :name,
    'Script' => :script,
    'Args' => :args,
    '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