newrelic / check_docker

A Go Nagios check for Docker
BSD 2-Clause "Simplified" License
127 stars 31 forks source link

No ability to check separate containers with same image name #6

Open intjonathan opened 9 years ago

intjonathan commented 9 years ago

Given a docker ps like this:

CONTAINER ID        IMAGE                                                        COMMAND             CREATED             STATUS              PORTS                  NAMES
edefe9ea93f8        foo/baz:59977daa1075abda15d7495781c1cf458e0cd863   script/run          3 days ago          Up 3 days           0.0.0.0:8485->80/tcp   dreamy_archimedes
3e656b925a5c        foo/baz:59977daa1075abda15d7495781c1cf458e0cd863   script/run          3 days ago          Up 3 days           0.0.0.0:80->80/tcp     romantic_albattani

There's no way to write a check that validates both of these containers are up. Passing -image-id="foo/baz" returns OK: 2 containers up, but would return OK even if only one was.

zoni commented 9 years ago

10 solves this if you're willing to explicitly name your containers (the other solution I could think of would be to add the abilty to specify that a certain image is expected to have at least x number of containers running).