Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker input: add container state metrics #767

Closed
stanch opened this issue Feb 29, 2016 · 5 comments
Closed

Docker input: add container state metrics #767

stanch opened this issue Feb 29, 2016 · 5 comments

Comments

@stanch
Copy link

stanch commented Feb 29, 2016

Would be nice to have state metrics for each container, as exemplified by this JSON:

{
  "Running": 1,
  "Paused": 0,
  "Restarting": 0,
  "OOMKilled": 0,
  "Dead": 0
}

This information is available through docker inspect <container> (and I imagine through the API as well).

For the record, here's an abomination I'm using right now:

[[inputs.exec]]
  commands = [
    "sh -c \"docker inspect container1 | jq 'def b2i: if . then 1 else 0 end; .[] | { name: .Name, running: .State.Running | b2i, paused: .State.Paused | b2i, restarting: .State.Restarting | b2i }'\""
  ]

  data_format = "json"

  # measurement name suffix (for separating different commands)
  name_suffix = "_container1"
@jeromegn
Copy link

This would also make it possible to get display better charts for setups that don't cleanup dead containers so often.

@stanch
Copy link
Author

stanch commented Sep 24, 2016

Hi, I don’t think the issue should be closed. The merged commit only adds global container state metrics (see https://github.com/influxdata/telegraf/pull/1791/files#diff-691fdaed73e36497110e1ea47c1498f5R157), while the issue was about per-container metrics.

@prashanthjbabu
Copy link
Contributor

Hi,I'd like to know if per container state metrics is supported now by any chance or if there's any plan to support it ?

@prashanthjbabu
Copy link
Contributor

I've attempted to implement this in the following pull request #4259 . I hope this helps!

@GeorgeMac
Copy link
Contributor

Delivered in #4259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants