Class: Wakame::Monitor::Service::ServiceChecker
- Inherits:
-
Object
- Object
- Wakame::Monitor::Service::ServiceChecker
- Defined in:
- lib/wakame/monitor/service.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#interval ⇒ Object
readonly
include Wakame::Packets::Agent.
-
#last_checked_at ⇒ Object
Returns the value of attribute last_checked_at.
-
#status ⇒ Object
Returns the value of attribute status.
-
#svc_id ⇒ Object
readonly
include Wakame::Packets::Agent.
-
#timer ⇒ Object
readonly
include Wakame::Packets::Agent.
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(svc_id, svc_mon, interval) ⇒ ServiceChecker
constructor
A new instance of ServiceChecker.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(svc_id, svc_mon, interval) ⇒ ServiceChecker
Returns a new instance of ServiceChecker.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/wakame/monitor/service.rb', line 11 def initialize(svc_id, svc_mon, interval) @svc_id = svc_id @service_monitor = svc_mon @interval = interval @status = Wakame::Service::STATUS_OFFLINE count = 0 @timer = Wakame::Monitor::CheckerTimer.new(@interval) { self.signal_checker } end |
Instance Attribute Details
#interval ⇒ Object (readonly)
include Wakame::Packets::Agent
8 9 10 |
# File 'lib/wakame/monitor/service.rb', line 8 def interval @interval end |
#last_checked_at ⇒ Object
Returns the value of attribute last_checked_at.
9 10 11 |
# File 'lib/wakame/monitor/service.rb', line 9 def last_checked_at @last_checked_at end |
#status ⇒ Object
Returns the value of attribute status.
9 10 11 |
# File 'lib/wakame/monitor/service.rb', line 9 def status @status end |
#svc_id ⇒ Object (readonly)
include Wakame::Packets::Agent
8 9 10 |
# File 'lib/wakame/monitor/service.rb', line 8 def svc_id @svc_id end |
#timer ⇒ Object (readonly)
include Wakame::Packets::Agent
8 9 10 |
# File 'lib/wakame/monitor/service.rb', line 8 def timer @timer end |
Instance Method Details
#check ⇒ Object
41 42 |
# File 'lib/wakame/monitor/service.rb', line 41 def check end |
#start ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/wakame/monitor/service.rb', line 22 def start if !@timer.running? # Runs checker once for immediate status update. signal_checker @timer.start @service_monitor.send_event(Wakame::Packets::MonitoringStarted.new(@service_monitor.agent, self.svc_id)) Wakame.log.debug("#{self.class}: Started the checker") end end |