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

Most plugins don't support connecting to a remote Docker daemon with TLS enabled #21

Open multani opened 8 years ago

multani commented 8 years ago

Typically:

 ./metrics-docker-stats.rb --container some-container --docker-host swarm-host:2375 --protocol http
Check failed to run: wrong status line: "\x15\x03\x01\x00\x02\x02", [
"/usr/lib/ruby/2.2.0/net/http/response.rb:41:in `read_status_line'",
"/usr/lib/ruby/2.2.0/net/http/response.rb:28:in `read_new'",
"/usr/lib/ruby/2.2.0/net/http.rb:1414:in `block in transport_request'",
"/usr/lib/ruby/2.2.0/net/http.rb:1411:in `catch'",
"/usr/lib/ruby/2.2.0/net/http.rb:1411:in `transport_request'",
"/usr/lib/ruby/2.2.0/net/http.rb:1384:in `request'",
"./metrics-docker-stats.rb:127:in `block in docker_api'",
"/usr/lib/ruby/2.2.0/net/http.rb:853:in `start'",
"/usr/lib/ruby/2.2.0/net/http.rb:583:in `start'",
"./metrics-docker-stats.rb:125:in `docker_api'",
"./metrics-docker-stats.rb:158:in `container_stats'",
"./metrics-docker-stats.rb:91:in `block in run'",
"./metrics-docker-stats.rb:90:in `each'",
"./metrics-docker-stats.rb:90:in `run'",
"/home/jballet/local/gems/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:56:in `block in <class:CLI>'"]

The plugins which are using the docker-api gem instead of manually doing the connection to the Docker daemon work OK though.

I would like to propose a patch which removes all these hand-crafted connection handlers and use this docker-api gem instead to connect to the Docker daemon, if it's possible. This would decrease the amount of code here while providing larger support of different kind of deployment.

As the same time, this would probably require (although not necessarily, but NOT doing it would just increase the size of the code) to change the different checks interface by requiring a single parameter which would be the URL to connect to (instead of -H + -p of some checks, -h or -u (really?) of the other checks). This would be of course a backward incompatible change.

majormoses commented 7 years ago

I am all for the first part I need to look through the code and think about how I feel about combining the params. Could we simply start with the first section and address the second one separately?