bin/metrics-nginx.rb in sensu-plugins-nginx-2.1.0 vs bin/metrics-nginx.rb in sensu-plugins-nginx-2.2.0

- old
+ new

@@ -59,10 +59,13 @@ default: 'nginx_status' option :hostheader, long: '--hostheader HOSTHEADER', description: 'Set the Host header to this string' + option :token, + long: '--token token', + description: 'JWT Token' option :scheme, description: 'Metric naming scheme, text to prepend to metric', short: '-s SCHEME', long: '--scheme SCHEME', @@ -83,9 +86,12 @@ http.verify_mode = OpenSSL::SSL::VERIFY_NONE end request = Net::HTTP::Get.new(uri.request_uri) if config[:hostheader] request['Host'] = config[:hostheader] + end + if config[:token] + request['Authorization'] = "Bearer #{config[:token]}" end response = http.request(request) if response.code == '200' found = true elsif !response.header['location'].nil?