Class: Zabbirc::Services::Events

Inherits:
Base
  • Object
show all
Defined in:
lib/zabbirc/services/events.rb

Constant Summary

Constants inherited from Base

Base::LOOP_SLEEP

Instance Attribute Summary

Attributes inherited from Base

#running

Instance Method Summary collapse

Methods inherited from Base

#initialize, #join, #start, #stop, #synchronize

Constructor Details

This class inherits a constructor from Zabbirc::Services::Base

Instance Method Details

#iterateObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/zabbirc/services/events.rb', line 4

def iterate
  synchronize do
    recent_events = Zabbix::Event.recent
    recent_events = filter_out_repeated_events(recent_events)

    recent_events.each do |event|
      @service.ops.interested_in(event).notify event
    end
  end
rescue Zabbix::NotConnected => e
  if Zabbix::Connection.up?
    @service.ops.interested.notify e.to_s
    Zabbix::Connection.down!
  end
end