bin/metrics-es-cluster.rb in sensu-plugins-elasticsearch-1.9.0 vs bin/metrics-es-cluster.rb in sensu-plugins-elasticsearch-1.10.0

- old
+ new

@@ -88,10 +88,14 @@ option :https, description: 'Enables HTTPS', short: '-e', long: '--https' + option :cert_file, + description: 'Cert file to use', + long: '--cert-file CERT_FILE' + def acquire_es_version info = get_es_resource('/') info['version']['number'] end @@ -106,10 +110,19 @@ 'https' else 'http' end - r = RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers) + r = if config[:cert_file] + RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}", + ssl_ca_file: config[:cert_file].to_s, + timeout: config[:timeout], + headers: headers) + else + RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}", + timeout: config[:timeout], + headers: headers) + end JSON.parse(r.get) rescue Errno::ECONNREFUSED warning 'Connection refused' rescue RestClient::RequestTimeout warning 'Connection timed out'