@@ -20,7 +20,6 @@ module Fluent
2020 module Plugin
2121 class HttpPullInput < Fluent ::Plugin ::Input
2222 Fluent ::Plugin . register_input ( "http_pull" , self )
23-
2423 helpers :timer , :parser , :compat_parameters
2524
2625 def initialize
@@ -29,19 +28,28 @@ def initialize
2928
3029 desc 'The tag of the event.'
3130 config_param :tag , :string
31+
3232 desc 'The url of monitoring target'
3333 config_param :url , :string
34+
3435 desc 'The interval time between periodic request'
3536 config_param :interval , :time
37+
3638 desc 'status_only'
3739 config_param :status_only , :bool , default : false
38- desc 'The timeout stime of each request'
40+
41+ desc 'The http method for each request'
42+ config_param :http_method , :enum , list : [ :get , :post , :delete ] , default : :get
43+
44+ desc 'The timeout second of each request'
3945 config_param :timeout , :time , default : 10
46+
4047 desc 'The HTTP proxy URL to use for each requests'
4148 config_param :proxy , :string , default : nil
4249
4350 desc 'user of basic auth'
4451 config_param :user , :string , default : nil
52+
4553 desc 'password of basic auth'
4654 config_param :password , :string , default : nil
4755
@@ -69,6 +77,8 @@ def configure(conf)
6977
7078 [ header . to_sym , value ]
7179 end . to_h
80+
81+ @http_method = :head if @status_only
7282 end
7383
7484 def start
@@ -81,7 +91,7 @@ def on_timer
8191 record = { "url" => @url }
8292
8393 begin
84- request_options = { method : :get , url : @url , timeout : @timeout }
94+ request_options = { method : @http_method , url : @url , timeout : @timeout }
8595
8696 request_options [ :proxy ] = @proxy if @proxy
8797 request_options [ :user ] = @user if @user
0 commit comments