sensu-plugins-docker icon indicating copy to clipboard operation
sensu-plugins-docker copied to clipboard

docker running but metrics-docker-container.rb says it's not

Open soichih opened this issue 9 years ago • 4 comments

I have a working docker engine on my machine, and I can do docker ps / info etc..

docker info
Containers: 10
Images: 202
Storage Driver: devicemapper
 Pool Name: docker-253:0-1382736-pool
 Pool Blocksize: 65.54 kB
 Backing Filesystem: xfs
 Data file:
 Metadata file:
 Data Space Used: 5.304 GB
 Data Space Total: 107.4 GB
 Data Space Available: 102.1 GB
 Metadata Space Used: 9.257 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.138 GB
 Udev Sync Supported: true
 Library Version: 1.02.93-RHEL7 (2015-01-28)
Execution Driver: native-0.2
Kernel Version: 3.10.0-229.7.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
CPUs: 2
Total Memory: 3.703 GiB
Name: core1.ppa.iu.edu
ID: KC6Z:U7IE:FCGQ:Y6ST:AL6K:VYNF:3NGC:ZA4H:LNWI:EI7K:EHPS:MPLE

But.. when I run metrics-docker-container.rb I get following error message.

# metrics-docker-container.rb
time="2015-09-14T17:07:54Z" level=fatal msg="Cannot connect to the Docker daemon. Is 'docker -d' running on this host?"

I tried "-H localhost" but that didn't fix it. What am I missing?

soichih avatar Sep 14 '15 17:09 soichih

Maybe sensu-client user cannot execute docker stats? sudo -u sensu /usr/bin/docker ps

jaarandaz avatar Mar 09 '16 13:03 jaarandaz

Is this still any issue for you?

eheydrick avatar May 24 '16 08:05 eheydrick

By default this plugin connects to port 2376, the TLS port. If your docker daemon is listening on port 2375 you'll need to adjust your check i.e. metrics-docker-container.rb -H tcp://127.0.1.1:2375. You can also use the unix socket metrics-docker-container.rb -H unix:///var/run/docker.sock. We should probably change the default port to 2375 as that's what all the other plugins use.

eheydrick avatar Jun 10 '16 15:06 eheydrick

Just in case anyone else comes across this, adding sensu to the 'docker' group and using the unix socket works for me.

crispibits avatar Nov 14 '16 17:11 crispibits