lib/flapjack/processor.rb in flapjack-0.8.5 vs lib/flapjack/processor.rb in flapjack-0.8.6
- old
+ new
@@ -173,18 +173,23 @@
# FIXME: create an event if there is dodgy data
case event.type
# Service events represent current state of checks on monitored systems
when 'service'
+ if event.failure?
+ # ensure that the check's hash is stored for later lookup
+ # can't happen inside the multi as it must get a value
+ event.id_hash = entity_check.ack_hash
+ end
+
@redis.multi
if event.ok?
@redis.hincrby('event_counters', 'ok', 1)
@redis.hincrby("event_counters:#{@instance_id}", 'ok', 1)
elsif event.failure?
@redis.hincrby('event_counters', 'failure', 1)
@redis.hincrby("event_counters:#{@instance_id}", 'failure', 1)
- @redis.hset('unacknowledged_failures', event.counter, event.id)
end
@redis.exec
previous_state = entity_check.state
@@ -215,13 +220,9 @@
# When an action event is processed, store the event.
@redis.multi
@redis.hset(event.id + ':actions', timestamp, event.state)
@redis.hincrby('event_counters', 'action', 1)
@redis.hincrby("event_counters:#{@instance_id}", 'action', 1)
-
- if event.acknowledgement? && event.acknowledgement_id
- @redis.hdel('unacknowledged_failures', event.acknowledgement_id)
- end
@redis.exec
end
[result, previous_state]
end