Class: Reacter::FilterAgent
Instance Attribute Summary
Attributes inherited from Agent
Instance Method Summary collapse
-
#initialize ⇒ FilterAgent
constructor
A new instance of FilterAgent.
- #received(message) ⇒ Object
Methods inherited from Agent
Constructor Details
#initialize ⇒ FilterAgent
Returns a new instance of FilterAgent.
8 9 10 11 |
# File 'lib/reacter/agents/filter.rb', line 8 def initialize() super @@_rxcache = {} end |
Instance Method Details
#received(message) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/reacter/agents/filter.rb', line 13 def received() if @config['sources'].is_a?(Hash) # config not found, drop return false if @config['sources'].empty? @config['sources'].each do |sources, metrics| sources = [*sources] metrics = [*metrics] sources.each do |source| if source === 'default' or _property_match?(.source, source) # no metrics means all metrics! return if metrics.nil? or metrics.first === true or metrics.empty? metrics.each do |metric| if _property_match?(.metric, metric) return end end end end end end return false end |