Class: Fluent::Plugin::RedfishMetricFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/fluent/plugin/filter_redfishmetric.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



14
15
16
17
18
# File 'lib/fluent/plugin/filter_redfishmetric.rb', line 14

def configure(conf)
   super
   @metricValueList = []
   # Do the usual configuration here
end

#filter_stream(tag, es) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fluent/plugin/filter_redfishmetric.rb', line 20

def filter_stream(tag, es)
  new_es = Fluent::MultiEventStream.new
  es.each { |time, record|
		@metricValueList = record["MetricValues"]
		@metricValueList&.each do |val|
begin
			myRecord = {}
			myRecord["Namespace"] = @Namespace
			myRecord["Report"] = record["Id"]
			myRecord["Metric"] = val["MetricId"]
			myRecord["Value"] = val["MetricValue"]
			myRecord["Dimension"] = {"Region" => @Coloregion, "IP" => record["REMOTE_ADDR"]}
			if @Filter
       if @Metric&.include?(val["MetricId"])
     new_es.add(time, myRecord)
 end
			else
          new_es.add(time, myRecord)
			end
      rescue => e
      router.emit_error_event(tag, time, record, e)
      end
		end
  }
  new_es
end