lib/flapjack/processor.rb in flapjack-0.8.10 vs lib/flapjack/processor.rb in flapjack-0.8.11

- old
+ new

@@ -56,17 +56,17 @@ # FIXME: all of the below keys assume there is only ever one executive running; # we could generate a fuid and save it to disk, and prepend it from that # point on... # FIXME: add an administrative function to reset all event counters - + @redis.hset('event_counters', 'all', 0) if @redis.hget('event_counters', 'all').nil? @redis.hset('event_counters', 'ok', 0) if @redis.hget('event_counters', 'ok').nil? @redis.hset('event_counters', 'failure', 0) if @redis.hget('event_counters', 'failure').nil? @redis.hset('event_counters', 'action', 0) if @redis.hget('event_counters', 'action').nil? @redis.hset('event_counters', 'invalid', 0) if @redis.hget('event_counters', 'invalid').nil? - + @redis.hset("executive_instance:#{@instance_id}", 'boot_time', boot_time.to_i) @redis.hset("event_counters:#{@instance_id}", 'all', 0) @redis.hset("event_counters:#{@instance_id}", 'ok', 0) @redis.hset("event_counters:#{@instance_id}", 'failure', 0) @redis.hset("event_counters:#{@instance_id}", 'action', 0) @@ -144,11 +144,11 @@ event_str = "#{event.id}, #{event.type}, #{event.state}, #{event.summary}" event_str << ", #{Time.at(event.time).to_s}" if event.time @logger.debug("Processing Event: #{event_str}") - entity_check = Flapjack::Data::EntityCheck.for_event_id(event.id, :redis => @redis) + entity_check = Flapjack::Data::EntityCheck.for_event_id(event.id, :create_entity => true, :redis => @redis) timestamp = Time.now.to_i event.tags = (event.tags || Flapjack::Data::TagSet.new) + entity_check.tags should_notify, previous_state = update_keys(event, entity_check, timestamp) @@ -172,11 +172,11 @@ result = true previous_state = nil event.counter = @redis.hincrby('event_counters', 'all', 1) @redis.hincrby("event_counters:#{@instance_id}", 'all', 1) - + # FIXME skip if entity_check.nil? # FIXME: validate that the event is sane before we ever get here # FIXME: create an event if there is dodgy data @@ -221,11 +221,12 @@ result = false end end entity_check.update_state(event.state, :timestamp => timestamp, - :summary => event.summary, :count => event.counter, :details => event.details) + :summary => event.summary, :count => event.counter, + :details => event.details, :perfdata => event.perfdata) entity_check.update_current_scheduled_maintenance # Action events represent human or automated interaction with Flapjack when 'action' @@ -274,6 +275,5 @@ return hs.last end end end -