Sha256: d8a61b057a3ac54e93d9d881caebfe993f37eb6fad327e2a7d7bc598d02adb4a
Contents?: true
Size: 1008 Bytes
Versions: 9
Compression:
Stored size: 1008 Bytes
Contents
# # DESCRIPTION: # Common helper methods # # DEPENDENCIES: # gem: elasticsearch # gem: sensu-plugin # # USAGE: # # NOTES: # # LICENSE: # Brendan Gibat <brendan.gibat@gmail.com> # Released under the same terms as Sensu (the MIT license); see LICENSE # for details. # require_relative 'elasticsearch-query.rb' module ElasticsearchCommon include ElasticsearchQuery def initialize super() end def client @client ||= begin if !config[:user].nil? && !config[:pass].nil? && !config[:scheme].nil? Elasticsearch::Client.new hosts: [{ host: config[:host], port: config[:port], user: config[:user], password: config[:password], scheme: config[:scheme], request_timeout: config[:timeout] }] else Elasticsearch::Client.new host: "#{config[:host]}:#{config[:port]}", request_timeout: config[:timeout] end end end end
Version data entries
9 entries across 9 versions & 1 rubygems