sensu-plugins / sensu-plugins-docker

This plugin provides native Docker instrumentation for monitoring and metrics collection, including: container status, container number, and container metrics via `docker ps`.
http://sensu-plugins.io
MIT License
35 stars 57 forks source link

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

Open soichih opened 8 years ago

soichih commented 8 years ago

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?

jaarandaz commented 8 years ago

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

eheydrick commented 8 years ago

Is this still any issue for you?

eheydrick commented 8 years ago

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.

crispibits commented 7 years ago

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