Closed thaJeztah closed 8 years ago
Isn't this expected for health_status
since the action is health_status: healthy
and health_status: unhealthy
? You can see here that's how the tests look for those events. That was one reason I made https://github.com/docker/docker/issues/24720.
hm, perhaps, weird thing is though that for exec_start
it also fails, and I doubt people will filter for --filter "event=exec_create: /bin/sh -c stat /etc/passwd || exit 1"
So, hm, yes, challenge (I see it possibly being useful to filter for only "healthy" events, or the opposite
Perhaps --filter event=health_status --filter event-message=healthy
(or similar)
@jhorwit2 what do you think would be best? would you expect to always be filtering on "event + status"?
@jhorwit2 the action should be something like an enum, and thus to real status should be somewhere in the attributes (a status
attribute for example) — i.e the event action is a health_status
, and the value (or one of the value) is healthy
or something else.
We could add another filter for events attributes but this should be definitely fixed by used constant event action. I'm on it :angel:
@thaJeztah Albeit cumbersome / hard to remember, filtering on health_status: healthy
and health_status: unhealthy
has been exactly what I wanted when I was monitoring for those.
I like health
action with a state
attribute of healthy
or unhealthy
though. Personally i'm starting to find status overloaded/confusing. The container struct has an attribute State
which is a combination of health state + container state + uptime. Then in docker ps
that's under the STATUS
header. It's also Status in the container json obj returned from the daemon. https://github.com/docker/docker/blob/master/daemon/list.go#L467
edit: after thinking more, if we are going with health_status
then an attribute of status
makes more sense.
@jhorwit2 would "health-status" (instead of "status") be better? Naming is hard 😅
oh darn, so hard, that of course the event already is named like that, haha
don't know what would be good for filtering the health-status result.
Naming is hardest problem in CS 👼
Output of
docker version
:Steps to reproduce the issue:
In one terminal:
In another terminal;
Describe the results you received:
Describe the results you expected:
Additional information you deem important (e.g. issue happens only occasionally):
I tried to reproduce on older versions of docker, and this seems to work on Docker 1.8, but fails on Docker 1.9
I debugged this issue, and as far as I can see, the cause of this is that, unlike other events, the
event.Action
forexec_create
,exec_start
, andhealth_status
contains additional output. This is the content ofevent.Action
of events fired by the example container;The filter executes an exact match on
event.Action
(ef.filter.ExactMatch("event", ev.Action)
), and fails to recognize the events due to this extra output;See daemon/events/filter.go#L21), and vendor/src/github.com/docker/engine-api/types/filters/parse.go#L209-L219
Possibly we can change the
ef.filter.ExactMatch()
withef.filter.FuzzyMatch()
, however that would result in--filter event=exec
to match bothexec_start
andexec_create
(not sure we want that).If we want this filter to be an "exact" match, we could filter on;
start
)exec_start:
(the event name provided, but with a colon (:
) afterThis would prevent
exec
to matchexec_start
.