Top Level Namespace

Defined Under Namespace

Modules: SensuPluginsDocker

Instance Method Summary collapse

Instance Method Details

#create_docker_clientObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sensu-plugins-docker/client_helpers.rb', line 3

def create_docker_client
  client = nil
  if config[:docker_host][0] == '/'
    host = 'unix://' + config[:docker_host]
    client = NetX::HTTPUnix.new(host)
  else
    split_host = config[:docker_host].split ':'
    client = if split_host.length == 2
               NetX::HTTPUnix.new(split_host[0], split_host[1])
             else
               NetX::HTTPUnix.new(config[:docker_host], 2375)
             end
  end

  client
end