Module: Sensu::API::Utilities::ResolveEvent

Includes:
PublishCheckResult
Defined in:
lib/sensu/api/utilities/resolve_event.rb

Instance Method Summary collapse

Methods included from PublishCheckResult

#publish_check_result

Instance Method Details

#resolve_event(event_json) ⇒ Object

Resolve an event. This method publishes a check result with a check status of ‘0` (OK) to resolve the event. The published check result uses `force_resolve` to ensure the event is resolved and removed from the registry, even if the current event has an event action of `flapping` etc.

Parameters:

  • event_json (String)

    JSON formatted event data.



16
17
18
19
20
21
22
23
24
25
# File 'lib/sensu/api/utilities/resolve_event.rb', line 16

def resolve_event(event_json)
  event = Sensu::JSON.load(event_json)
  check = event[:check].merge(
    :output => "Resolving on request of the API",
    :status => 0,
    :force_resolve => true
  )
  check.delete(:history)
  publish_check_result(event[:client][:name], check)
end