-
Notifications
You must be signed in to change notification settings - Fork 268
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
CPU user time over 8000% ? #30
Comments
That's normal. The right concept for CPU monitoring is collector. Fortunately, it's not easy to implement collector as module, because consistent storage is required. So only basic CPU math from CPU counters is used. See http://www.labouisse.com/how-to/2014/11/18/simple-monitoring-for-docker-part-2/ You can use docker.stat[], which is stat directly from docker not from cpu counters. |
Thanks for the link. So, basically I will need to use a python script (like the one from labouisse.com) to have a cpu math that looks like docker stats, right ? The script will probably look like this: https://github.com/docker/docker/blob/master/api/client/stats.go#L81 right? I've just started to learn zabbix :) |
No. See https://www.kernel.org/doc/Documentation/cgroups/cpuacct.txt what are cpu cgroup counters.
How do you calculate cpu percentage if you have only cpu counter in Zabbix? You need to change it into rate (delta per sec in Zabbix template). Then you multiply it by 100 (multiplier in Zabbix template). That's about provided links. You don't need root permission for cpu counters, so this is default method in my template. You can see a unrealistic peak eg 8000%, but values are correct in avg eg. avg 1 day. You like cpu usage metric value reported by docker (docker stats command) and this option is also available in my module - see README about docker.stats[]:
If you want to use this method, then you need to modify my Docker template/create new template. Just keep in mind, it's avg value for last X second (IMO 5). Docker monitoring is not the easiest way how to learn Zabbix. I recommend to start with official doc https://www.zabbix.com/documentation/2.4/manual |
Thank you once again. I am learning a lot. What I am trying to achieve is getting some CPU / memory / Disk I/O Graphs for the docker host (individually and comparing with one or more running containers). The thing is that I am not getting just an unrealistic peak of 8000% (even google/cAdvisor we can get strange peaks ...), I am getting a avg of 4000% and min of 2000% in a CPU stress container that runs for 1 hour. I will try docker.stats[..] |
What's you config (docker version/execution driver, OS, number of CPUs)? |
My machine is a MacBook Pro Mid 2010 - Intel Core 2 Duo 2.4 with 8Gb Ram Running 2 Ubuntu 15 VM's (VirtualBox) with 2Gb RAM each. Zabbix Server (1 CPU /proc/cpuinfo shows 1 CPU 1 core): Docker Host (2 CPUs /proc/cpuinfo shows 2 CPUs with 2 cores each): |
Hello again. I have implemented a shell script to calculate CPU % of a running container. I based the code in "docker stats" golang source. Zabbix is collecting results fine. But I notice a 5%-15% difference between docker-stats and systemd-cgtop. I was not able to collect systemd-cgtop CPU% using a bash script, so I was wondering if your implementation could use systemd-cgtop implementation. Is it possible? What is necessary ? |
Great. 1.) Is it really the best CPU usage algorithm? 2.) systemd-cgtop is not the best implementation for Zabbix |
I dont know if systemd-cgtop is the best CPU usage algorithm, but it seems more accurate than docker-stats (I will explain my tests bellow) . I like this module. It's elegant, but in my environment I couldn't make it to show CPU usage correctly (While I get 8000% with the module, docker-stats are showing 105% and systemd-cgtop 99.5% ) My tests were simple:
Docker host has 2 vCPUs,
docker-stats shows:
The CPU usage changes a little, when I and using cpuset-cpus=1
systemd-cgtop shows:
docker-stats shows:
The point is: when I limit container to just 1 cpu, systemd-cgtop will almost never goes over 100% in a 2 vCPUs VM while within docker-stats this behavior happens very often. I am not an C expert, but if I got it right, this module lets CPU % usage calcs to zabbix (using deltas), I was wondering how to use the module for doing the calcs inside it (no zabbix deltas calcs). |
I know, that implementation for CPU monitoring is not perfect. It's in my long term TODO. Feel free to create PR - cgtop CPU monitoring implementation can be at least some experimental feature - |
@jangaraj Thanks for you work! Grate for monitoring docker hosts with Zabbix! But I find your template formula for cpu stats |
@berlic You can - http://serverfault.com/questions/441897/how-to-calculate-cpu-based-on-raw-cpu-ticks-in-snmp. Linux: usually 100 ticks per second => 100tick/sec = 100% CPU usage |
Hi,
I am using App Docker Template active (30s interval). Zabbix discovery is working nice when I start a new container.
I am running a stress test container. I have an Intel Core 2 Duo processor (Mac Book Pro 2011). The container is running inside a VirtualBox VM (2 CPUs 2Gb RAM).
The curious thing is that the CPU user time graph for this container is showing over 8000% (eight thousand). Is that right?
Inside docker host, if i run docker stats <stress_container> I get around 250% CPU, sometimes it goes to 300%. I presence quick tick of over 410%.
How this measure works ?
Thank you.
The text was updated successfully, but these errors were encountered: