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

Add option for task oriented containers #62

Closed antonidabek closed 6 years ago

antonidabek commented 6 years ago

In some cases docker containers would be used on demand or started periodically to execute certain tasks. Option -x would allow to monitor them and only raise alerts if they have exited with error (status code different from zero).

majormoses commented 6 years ago

Thanks for your contribution to Sensu plugins! Without people like you submitting PRs we couldn't run the project. I will review it shortly.

antonidabek commented 6 years ago

OK, is there a PR where I could see example of test being added?

antonidabek commented 6 years ago

I think there is no automated tests if I get code correctly in this repo, I will add them in separate PR. It seems that https://github.com/geku/docker-client has work done on exposing Docker API to tests.

majormoses commented 6 years ago

For pretty much everything else I have been using test-kitchen with kitchen-docker as a driver but that poses the issue of docker in docker so I am not sure but I'd like to see what kind of options we have to keep the toolset as similar as possible. Here is a blog post I put together on integration testing for plugins. Even if you end up selecting different tools it is still a good read about writing clean integration tests in general. Let me know if I can be of any help.

antonidabek commented 6 years ago

I added some test, I guess please though look first at #63 where is the code to start docker in docker.

majormoses commented 6 years ago

I left a comment regarding the testing over there it looks good just one tweak. Would you rather adding the base testing in the other PR and then rebase this one or would you prefer to do it all here? Either way is fine with me as long as we are not doing the exact same thing in both places.

antonidabek commented 6 years ago

I will rebase this one :-)

majormoses commented 6 years ago

@antonidabek I merged the other and will review after you rebase and fix conflicts.

antonidabek commented 6 years ago

I rebased patch, updated changelog and added one more test case.