Skip to content

Commit

Permalink
percpu is total
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianKniep committed Dec 8, 2016
1 parent aea7527 commit 89abf73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
12 changes: 3 additions & 9 deletions collectors/0/docker_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion collectors/etc/docker_containers_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 89abf73

Please sign in to comment.