Skip to content

Commit

Permalink
fix meta
Browse files Browse the repository at this point in the history
  • Loading branch information
stokito committed Nov 19, 2020
1 parent 39f2e62 commit 9b6520f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions connector/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/op/go-logging"
"strings"
"sync"
"time"
)

func init() { enabled["docker"] = NewDocker }
Expand Down Expand Up @@ -178,9 +179,13 @@ func (cm *Docker) refresh(c *container.Container) {
c.SetMeta("image", insp.Config.Image)
c.SetMeta("IPs", ipsFormat(insp.NetworkSettings.Networks))
c.SetMeta("ports", portsFormat(insp.NetworkSettings.Ports))
//FIXME c.SetMeta("created", insp.Created.Format("Mon Jan 2 15:04:05 2006"))
c.SetMeta("created", insp.Created)
//c.SetMeta("health", insp.State.Health.Status)
created, e := time.Parse(time.RFC3339, insp.Created)
if e == nil {
c.SetMeta("created", created.Format("Mon Jan 2 15:04:05 2006"))
}
if insp.State.Health != nil {
c.SetMeta("health", insp.State.Health.Status)
}
for _, env := range insp.Config.Env {
c.SetMeta("[ENV-VAR]", env)
}
Expand All @@ -189,7 +194,7 @@ func (cm *Docker) refresh(c *container.Container) {

func (cm *Docker) inspect(id string) (types.ContainerJSON, bool) {
ctx := context.Background()
c, err := cm.client.ContainerInspect(ctx, "ololo"+id)
c, err := cm.client.ContainerInspect(ctx, id)
if err != nil {
if !client.IsErrNotFound(err) {
log.Errorf("%s (%T)", err.Error(), err)
Expand Down

0 comments on commit 9b6520f

Please sign in to comment.