-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Use docker client CPU & memory percent helper functions #2457
Comments
looks like the official docker client may have a better way of getting the cpu usage percentages than what we're currently doing. Changing this issue to re-evaluate that as a whole. |
@sparrc Hi Cameron I see that you renamed the issue to "Use docker client CPU percent helper functions" but the bug is not only about CPU. As I wrote output of memory stats is also incorrect. |
@sparrc Hi Cameron, If it is usefull I pushed my quick changes to fix our internal monitoring Sorry for my ugly code, it were my first hours with Golang :) On thing that I faced with similar error when I tried to perform
To resolve it I had to delete this folder from docker vendors direcotory |
Forgot to mention that it is branche form 1.1 version as we use exact that version on our servers now |
@georgyturevich We have changed the docker client for the next release, are you able to test with the latest nightly and provide an update? |
@danielnelson Hi Daniel, I can have look but I do not see significant changes in the code. It is still use single function for calculating CPU docker.go#L387 but for Windows we should use another like there in my simple fix commit #diff-691fdaed...R431 . Also for windows we do not have enough data to calculate Memory percentage. Docker API returns only following three stats:
|
@georgyturevich there is one thing wrong in your code : the use of runtime.GOOS to detect the OS will give you the OS on which Telegraf is running, which might be different then the host Docker is running on (users can collect metrics on a docker daemon running on a different host, using the tcp socket). You might better rely on the OSType obtained from the daemon info, like it is done for the name of the daemon here : https://github.com/georgyturevich/telegraf/blob/80cf1cbbfe9be2f28a4ca3555f84f82eba227c94/plugins/inputs/docker/docker.go#L152 |
Fixed in #3043 |
Hello there,
Relevant telegraf.conf:
System info:
Telegraf version:
Telegraf v1.1.1 (git: release-1.1.0 94de9dca1fc6efb3a4bf3ec6869c356278c6755a)
Operating system:
Windows Server 2016 Version 1607 (OS Build 14393.693)
Output of
docker version
Steps to reproduce:
When we try to request stats data about container from Docker API (e.g http://host:2375/containers/gt_test_iis/stats). It shows us
which is quite different from otput which we can se on Linux
So as a result - we see a lot of zero memory stats
Another thing that CPU percentage also is calculated incorrectly. At least these two
And I do not have clear understanding what following stats can mean for Windows containers
You can see how Docker itself calculates CPU percentage there
but Telegraf use another algoritm for calculating CPU percentage there
It works fine for Linux docker but not for Windows where we do not have stat.CPUStats.SystemUsage variable at all as you can see.
Proposal
So, may be it makes seance to leave only following stats for mem/cpu on Windows, which is known how to calculate correctly
May be you can also suppose other statistics.
Thanks in advance!
The text was updated successfully, but these errors were encountered: