Module: Consul::Client::Agent::HealthCheck

Defined in:
lib/consul/client/agent.rb

Class Method Summary collapse

Class Method Details

.http(name, http, interval, id = name, notes = nil) ⇒ Object

Public: HTTP Check

name - The name of the check, Cannot be nil http - The HTTP endpoint to hit with periodic GET. interval - The time interval to conduct the check. IE: ‘10s’ id - ID to associate with this check if ‘name’ is not desired. notes - Message to place as notes for this check

Returns: Consul::Model::HealthCheck instance



239
240
241
242
243
244
245
246
247
# File 'lib/consul/client/agent.rb', line 239

def self.http(name, http, interval, id = name, notes = nil)
  validate_arg name
  validate_arg http
  validate_arg interval
  c = Consul::Model::HealthCheck.new(name: name, http: http, interval: interval)
  c.id = id unless id.nil?
  c.notes = notes unless notes.nil?
  c
end

.script(name, script, interval, id = name, notes = nil) ⇒ Object

Public: Script Check

name - The name of the check, Cannot be nil script - The script to run locally interval - The time interval to conduct the check. IE: ‘10s’ id - ID to associate with this check if ‘name’ is not desired. notes - Message to place as notes for this check.

Returns: Consul::Model::HealthCheck instance



220
221
222
223
224
225
226
227
228
# File 'lib/consul/client/agent.rb', line 220

def self.script(name, script, interval, id = name, notes = nil)
  validate_arg name
  validate_arg script
  validate_arg interval
  c = Consul::Model::HealthCheck.new(name: name, script: script, interval: interval)
  c.id = id unless id.nil?
  c.notes = notes unless notes.nil?
  c
end

.ttl(name, ttl, id = name, notes = nil) ⇒ Object

Public: TTL Check

name - The name of the check, Cannot be nil ttl - Time to live time window. IE “15s”, Cannot be nil id - ID to associate with this check if ‘name’ is not desired. notes - Message to place as notes for this check

Returns: Consul::Model::HealthCheck instance



202
203
204
205
206
207
208
209
# File 'lib/consul/client/agent.rb', line 202

def self.ttl(name, ttl, id = name, notes = nil)
  validate_arg name
  validate_arg ttl
  c = Consul::Model::HealthCheck.new(name: name, ttl: ttl)
  c.id = id unless id.nil?
  c.notes = notes unless notes.nil?
  c
end