Method: Sensu::Client::Process#deregister

Defined in:
lib/sensu/client/process.rb

#deregisterObject

Create a check result intended for deregistering a client. Client definitions may contain ‘:deregistration` configuration, containing custom attributes and handler information. By default, the deregistration check result sets the `:handler` to `deregistration`. If the client provides its own `:deregistration` configuration, it’s deep merged with the defaults. The check ‘:name`, `:output`, `:status`, `:issued`, and `:executed` values are always overridden to guard against an invalid definition.



388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/sensu/client/process.rb', line 388

def deregister
  check = {:handler => "deregistration", :interval => 1}
  if @settings[:client].has_key?(:deregistration)
    check = deep_merge(check, @settings[:client][:deregistration])
  end
  timestamp = Time.now.to_i
  overrides = {
    :name => "deregistration",
    :output => "client initiated deregistration",
    :status => 1,
    :issued => timestamp,
    :executed => timestamp
  }
  publish_check_result(check.merge(overrides))
end