diff options
author | Jake Correnti <jcorrenti13@gmail.com> | 2022-06-22 16:16:25 -0400 |
---|---|---|
committer | Jake Correnti <jcorrenti13@gmail.com> | 2022-06-27 10:44:53 -0400 |
commit | 0c1a3b70f5f1b8a3f8d336c6576518fae26c37cf (patch) | |
tree | c177c73f4cb8ab7d4cf09b79391f8573ea50685d /libpod/events/events.go | |
parent | b34cba6cd53cfd4df58f2b26d3e5a6be86dfb132 (diff) | |
download | podman-0c1a3b70f5f1b8a3f8d336c6576518fae26c37cf.tar.gz podman-0c1a3b70f5f1b8a3f8d336c6576518fae26c37cf.tar.bz2 podman-0c1a3b70f5f1b8a3f8d336c6576518fae26c37cf.zip |
Show Health Status events
Previously, health status events were not being generated at all. Both
the API and `podman events` will generate health_status events.
```
{"status":"health_status","id":"ae498ac3aa6c63db8b69a37583a6eae1a9cefbdbdbeeadcf8e1d66d745f0df63","from":"localhost/healthcheck-demo:latest","Type":"container","Action":"health_status","Actor":{"ID":"ae498ac3aa6c63db8b69a37583a6eae1a9cefbdbdbeeadcf8e1d66d745f0df63","Attributes":{"containerExitCode":"0","image":"localhost/healthcheck-demo:latest","io.buildah.version":"1.26.1","maintainer":"NGINX Docker Maintainers \u003cdocker-maint@nginx.com\u003e","name":"healthcheck-demo"}},"scope":"local","time":1656082205,"timeNano":1656082205882271276,"HealthStatus":"healthy"}
```
```
2022-06-24 11:06:04.886238493 -0400 EDT container health_status ae498ac3aa6c63db8b69a37583a6eae1a9cefbdbdbeeadcf8e1d66d745f0df63 (image=localhost/healthcheck-demo:latest, name=healthcheck-demo, health_status=healthy, io.buildah.version=1.26.1, maintainer=NGINX Docker Maintainers <docker-maint@nginx.com>)
```
Signed-off-by: Jake Correnti <jcorrenti13@gmail.com>
Diffstat (limited to 'libpod/events/events.go')
-rw-r--r-- | libpod/events/events.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libpod/events/events.go b/libpod/events/events.go index a30e0f1ca..a8001ab95 100644 --- a/libpod/events/events.go +++ b/libpod/events/events.go @@ -76,7 +76,7 @@ func (e *Event) ToHumanReadable(truncate bool) string { } switch e.Type { case Container, Pod: - humanFormat = fmt.Sprintf("%s %s %s %s (image=%s, name=%s", e.Time, e.Type, e.Status, id, e.Image, e.Name) + humanFormat = fmt.Sprintf("%s %s %s %s (image=%s, name=%s, health_status=%s", e.Time, e.Type, e.Status, id, e.Image, e.Name, e.HealthStatus) // check if the container has labels and add it to the output if len(e.Attributes) > 0 { for k, v := range e.Attributes { @@ -168,6 +168,8 @@ func StringToStatus(name string) (Status, error) { return Exited, nil case Export.String(): return Export, nil + case HealthStatus.String(): + return HealthStatus, nil case History.String(): return History, nil case Import.String(): |