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: TTL 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



205
206
207
208
209
210
211
212
213
# File 'lib/consul/client/agent.rb', line 205

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, script: script, 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: TTL 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



186
187
188
189
190
191
192
193
194
# File 'lib/consul/client/agent.rb', line 186

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



168
169
170
171
172
173
174
175
# File 'lib/consul/client/agent.rb', line 168

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