Class: Fluent::HttpStatusInput
- Inherits:
-
Input
- Object
- Input
- Fluent::HttpStatusInput
- Defined in:
- lib/fluent/plugin/in_http_status.rb
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/fluent/plugin/in_http_status.rb', line 25 def configure(conf) super @params = @params.split(',').map{|str| str.strip} unless @params.nil? @polling_time = @polling_time.split(',').map{|str| str.strip} unless @polling_time.nil? raise ConfigError, "snmp: 'polling_time' parameter is required on snmp input" if !@polling_time.nil? && @polling_time.empty? @retry_count = 0 end |
#run ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/fluent/plugin/in_http_status.rb', line 42 def run Polling::run(@polling_time) do record = Hash.new args = { :url => @url, :port => @port, :proxy_address => @proxy_address, :proxy_port => @proxy_port, :proxy_user => @proxy_user, :proxy_password => @proxy_password, :params => @params } Engine.emit(@tag, Engine.now, get_status(record,args)) break if @end_flag end rescue TypeError => ex $log.error "run TypeError", :error=>ex. exit rescue => ex $log.error "run failed", :error=>ex. sleep(10) @retry_count += 1 retry if @retry_count < 30 end |
#shutdown ⇒ Object
67 68 69 70 71 72 |
# File 'lib/fluent/plugin/in_http_status.rb', line 67 def shutdown @end_flag ||= true @thread.run @thread.join @starter.join end |
#start ⇒ Object
38 39 40 |
# File 'lib/fluent/plugin/in_http_status.rb', line 38 def start starter{@thread=Thread.new(&method(:run))} end |
#starter ⇒ Object
33 34 35 36 |
# File 'lib/fluent/plugin/in_http_status.rb', line 33 def starter Net::HTTP.version_1_2 @starter=Thread.new{yield} end |