From 89abf73c49ff5d8d414b0d39fad19e2611ffa91f Mon Sep 17 00:00:00 2001 From: Christian Kniep Date: Thu, 8 Dec 2016 14:22:03 +0100 Subject: [PATCH] percpu is total --- collectors/0/docker_containers.py | 12 +++--------- collectors/etc/docker_containers_conf.py | 3 ++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/collectors/0/docker_containers.py b/collectors/0/docker_containers.py index 7d2b9b32..1e3c6500 100755 --- a/collectors/0/docker_containers.py +++ b/collectors/0/docker_containers.py @@ -69,15 +69,9 @@ def evalCpu(self, pre, cur): for i, cur_percpu in list(enumerate(cur["cpu_usage"]["percpu_usage"])): dims = [item for item in self.dims] dims.append("cpu=%d" % i) - cnt_user_ms = cur_percpu - pre["cpu_usage"]["percpu_usage"][i] - cnt_kernel_ms = cur_percpu - pre["cpu_usage"]["percpu_usage"][i] - percpu_user_percent = cnt_user_ms*100/system_usage_ms - m = Metric("cpu.cpu%d.user" % i, self.event_time, percpu_user_percent, dims) - ret.append(m) - percpu_kernel_percent = cnt_kernel_ms*100/system_usage_ms - m = Metric("cpu.cpu%d.kernel" % i, self.event_time, percpu_kernel_percent, dims) - ret.append(m) - m = Metric("cpu.cpu%d.all" % i, self.event_time, percpu_kernel_percent+percpu_user_percent, dims) + cnt_ms = cur_percpu - pre["cpu_usage"]["percpu_usage"][i] + percpu_percent = cnt_ms*100/system_usage_ms + m = Metric("cpu.cpu%d" % i, self.event_time, percpu_percent, dims) ret.append(m) return ret diff --git a/collectors/etc/docker_containers_conf.py b/collectors/etc/docker_containers_conf.py index 95e9a041..31bb3e31 100644 --- a/collectors/etc/docker_containers_conf.py +++ b/collectors/etc/docker_containers_conf.py @@ -21,7 +21,8 @@ def get_config(): config = { 'interval': 15, 'default_dims': [], - 'socket_path': 'unix:///var/run/docker.sock', + 'socket_path': 'tcp://192.168.100.10:2376', + #'socket_path': 'unix:///var/run/docker.sock', } return config