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

Get metrics from docker daemon #8842

Closed
tobegit3hub opened this issue Oct 29, 2014 · 11 comments
Closed

Get metrics from docker daemon #8842

tobegit3hub opened this issue Oct 29, 2014 · 11 comments
Milestone

Comments

@tobegit3hub
Copy link

I have found the tutorial to get metrics from cgroup in https://docs.docker.com/articles/runmetrics/.

It would be great for us to get the metrics of containers from docker client. Is that possible to implement something like docker metrics $ip? I know somebody has implemented this but not in trunk.

@thaJeztah
Copy link
Member

Perhaps this might be interesting for you; https://github.com/google/cadvisor and a nice blogpost on it; http://blog.tutum.co/2014/08/07/using-cadvisor-to-monitor-docker-containers/

Features are constantly being added to cAdvisor, so it's good to track their repository.

@tobegit3hub
Copy link
Author

Thanks @thaJeztah . I have known about cAdvisor and it's great. But sometimes I want to know about the resources of containers in the easy way like docker metrics in command-line.

It's would be better if the docker client supports this without install cAdvisor. I hope cAdvisor could help to develop then it can get metrics directly with docker remote api 😄

@monsterzz
Copy link
Contributor

I've made first simple implementation of this feature:

$ docker metrics 29cf9bcdbaf4f5ba77185aaeda9e0ecaa365eb6c7cd74b863864f9ec76755151
[{
    "Id": "29cf9bcdbaf4f5ba77185aaeda9e0ecaa365eb6c7cd74b863864f9ec76755151",
    "Image": "a9561eb1b190625c9adb5a9513e72c4dedafc1cb2d4c5236c9a6957ec7dfd5a9",
    "Metrics": {
        "CpuUsage": "55664035",
        "MemoryLimit": "9223372036854775807",
        "MemoryMaxUsage": "4517888",
        "MemoryUsage": "4517888"
    },
    "Name": "/kickass_albattani",
    "State": {
        "ExitCode": 0,
        "FinishedAt": "0001-01-01T00:00:00Z",
        "Paused": false,
        "Pid": 11696,
        "Restarting": false,
        "Running": true,
        "StartedAt": "2014-10-30T15:48:29.977000748Z"
    }
}
]

Code is ugly, but PoC is better than nothing. If someone is interested, we can collaborate on it and make it production ready (add tests, define proper metrics set, enhance usability (at least add -f option) and improve overall stability).

You can check code at: https://github.com/monsterzz/docker/compare/8842-docker-metrics

I think we need someone from docker in this issue :)

@tobegit3hub
Copy link
Author

That looks great. Thanks @monsterzz . Most developers need this to monitor the resources of their containers and I hope @shykes could pay attention to it.

discordianfish added a commit to discordianfish/docker that referenced this issue Nov 13, 2014
This is proposing to add per container metrics, based on cgroups, as well as
docker engine metrics about Docker's internal health and job management.

This will either solve or at least provide a basis to address moby#8875, moby#1091, moby#4530, moby#5473, moby#8842

Signed-off-by: Johannes 'fish' Ziemke <github@freigeist.org>
@wojons
Copy link

wojons commented Jan 1, 2015

Let me know if there is anything I can do to help with this. It will be great to get this info from over the api.

@SvenDowideit
Copy link
Contributor

@tobegit3hub @monsterzz @wojons I think what is really needed is a full Proposal - ie, a PR with the propsed documentation changes showing how it'll work.

I do get the feeling that @discordianfish is working on writing up something too.

@tobegit3hub
Copy link
Author

@SvenDowideit Great! Looking forward to this feature and let us know if we can do something.

@discordianfish
Copy link
Contributor

See the linked proposal: #9130 and let me know if something is still missing. From my perspective the next step would be to get this proposal acknowledged so we can start implementing it.

discordianfish added a commit to discordianfish/docker that referenced this issue Jan 5, 2015
This is proposing to add per container metrics, based on cgroups, as well as
docker engine metrics about Docker's internal health and job management.

This will either solve or at least provide a basis to address moby#8875, moby#1091, moby#4530, moby#5473, moby#8842

Signed-off-by: Johannes 'fish' Ziemke <github@freigeist.org>
@crosbymichael
Copy link
Contributor

@discordianfish I think you proposal add a few other features.

I'm going to go through each of these and see if I can get the container metrics ( resource usage ) implemented in the API as the first step.

@crosbymichael crosbymichael added this to the 1.5.0 milestone Jan 7, 2015
@crosbymichael
Copy link
Contributor

#9984 was merged so this is resolved. Hope you like it!

@tobegit3hub
Copy link
Author

Great 👍

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

Successfully merging a pull request may close this issue.

7 participants