Class: Wakame::MonitorRegistry
- Inherits:
-
Object
- Object
- Wakame::MonitorRegistry
- Defined in:
- lib/wakame/agent.rb
Instance Attribute Summary collapse
-
#monitors ⇒ Object
readonly
Returns the value of attribute monitors.
Instance Method Summary collapse
- #find_monitor(path) ⇒ Object
-
#initialize ⇒ MonitorRegistry
constructor
A new instance of MonitorRegistry.
- #register(monitor, path = nil) ⇒ Object
- #unregister(path) ⇒ Object
Constructor Details
#initialize ⇒ MonitorRegistry
Returns a new instance of MonitorRegistry.
154 155 156 |
# File 'lib/wakame/agent.rb', line 154 def initialize() @monitors = {} end |
Instance Attribute Details
#monitors ⇒ Object (readonly)
Returns the value of attribute monitors.
153 154 155 |
# File 'lib/wakame/agent.rb', line 153 def monitors @monitors end |
Instance Method Details
#find_monitor(path) ⇒ Object
177 178 179 |
# File 'lib/wakame/agent.rb', line 177 def find_monitor(path) @monitors[path] end |
#register(monitor, path = nil) ⇒ Object
158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/wakame/agent.rb', line 158 def register(monitor, path=nil) raise '' unless monitor.kind_of?(Wakame::Monitor) if path.nil? path = '/' + Util.to_const_path(monitor.class.to_s) end if @monitors.has_key?(path) Wakame.log.error("#{self.class}: Duplicate registration: #{path}") raise "Duplicate registration: #{path}" end @monitors[path] = monitor end |
#unregister(path) ⇒ Object
173 174 175 |
# File 'lib/wakame/agent.rb', line 173 def unregister(path) @monitors.delete(path) end |