Skip to content

Commit

Permalink
Merge pull request ManageIQ#58 from CharlleDaniel/events_filter
Browse files Browse the repository at this point in the history
Create events filter of Audit and System
  • Loading branch information
juliancheal authored Jun 6, 2017
2 parents 2b14177 + d8483a0 commit 95540b5
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class ManageIQ::Providers::Lenovo::PhysicalInfraManager::EventCatcher::Stream
require 'json'
# Creates an event monitor
#
def initialize(ems)
Expand Down Expand Up @@ -29,10 +30,18 @@ def event_monitor_handle

private

def filter_fields
[
{ :operation => 'GT', :field => 'cn', :value => get_last_cnn_from_events(@ems.id).to_s },
{ :operation => 'NOT', :field => 'eventClass', :value => '200' },
{ :operation => 'NOT', :field => 'eventClass', :value => '800' }
]
end

def events
expression = '{"filterType":"FIELDNOTREGEXAND","fields":["operation":"GT","field":"cn","value":"' + get_last_cnn_from_events(@ems.id).to_s + '"]}'
expression = { :filterType => 'FIELDNOTREGEXAND', :fields => filter_fields }

opts = {'filterWith' => expression}
opts = {'filterWith' => expression.to_json}

@event_monitor_handle.fetch_events opts
end
Expand Down

0 comments on commit 95540b5

Please sign in to comment.