lib/arborist/monitor_runner.rb in arborist-0.0.1.pre20160128152542 vs lib/arborist/monitor_runner.rb in arborist-0.0.1.pre20160606141735

- old
+ new

@@ -60,16 +60,16 @@ attr_predicate :registered ### Run the specified +monitor+ and update nodes with the results. def run_monitor( monitor ) - criteria = monitor.positive_criteria + positive = monitor.positive_criteria + negative = monitor.negative_criteria include_down = monitor.include_down? props = monitor.node_properties - self.fetch( criteria, include_down, props ) do |nodes| - # :FIXME: Doesn't apply negative criteria + self.fetch( positive, include_down, props, negative ) do |nodes| results = monitor.run( nodes ) self.update( results ) do self.log.debug "Updated %d via the '%s' monitor" % [ results.length, monitor.description ] end @@ -77,13 +77,14 @@ end ### Create a fetch request using the runner's client, then queue the request up ### with the specified +block+ as the callback. - def fetch( criteria, include_down, properties, &block ) + def fetch( criteria, include_down, properties, negative={}, &block ) fetch = self.client.make_fetch_request( criteria, include_down: include_down, - properties: properties + properties: properties, + exclude: negative ) self.queue_request( fetch, &block ) end