-
Notifications
You must be signed in to change notification settings - Fork 814
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
[docker] Fix pid retrieval #2847
Conversation
The fix looks good too me... 👍 Let's wait for @hkaj before merging :) |
@@ -806,6 +806,17 @@ def _parse_blkio_metrics(self, stats): | |||
metrics['io_write'] += int(line.split()[2]) | |||
return metrics | |||
|
|||
def _is_container_cgroup(self, line, selinux_policy): | |||
if line[1] not in ('cpu,cpuacct', 'cpuacct,cpu', 'cpuacct'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR looks good and can be merged as is, but if you change this line into if line[1] not in ('cpu,cpuacct', 'cpuacct,cpu', 'cpuacct') or line[2] == '/docker-daemon':
it would also fix #2841 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a comment about killing two birds with one stone, otherwise LGTM
Tested on 1.3, it works too. |
ac551f1
to
c9f3a97
Compare
On kubernetes a group file will look like ``` root@dd-agent-nightly-rc-jnexb:/host/proc/17916# cat cgroup 10:net_prio:/5e5f675ab3dbd1353837e46d158a6401abe0673324568b204a3a183ea6a 42772 9:perf_event:/5e5f675ab3dbd1353837e46d158a6401abe0673324568b204a3a183ea6 a42772 8:blkio:/5e5f675ab3dbd1353837e46d158a6401abe0673324568b204a3a183ea6a4277 2 7:net_cls:/5e5f675ab3dbd1353837e46d158a6401abe0673324568b204a3a183ea6a42 772 freezer:/5e5f675ab3dbd1353837e46d158a6401abe0673324568b204a3a183ea6a4277 2 5:devices:/5e5f675ab3dbd1353837e46d158a6401abe0673324568b204a3a183ea6a42 772 4:memory:/5e5f675ab3dbd1353837e46d158a6401abe0673324568b204a3a183ea6a427 72 3:cpuacct:/5e5f675ab3dbd1353837e46d158a6401abe0673324568b204a3a183ea6a42 772 2:cpu:/5e5f675ab3dbd1353837e46d158a6401abe0673324568b204a3a183ea6a42772 1:cpuset:/5e5f675ab3dbd1353837e46d158a6401abe0673324568b204a3a183ea6a427 72 ``` Which was previously ignored. The refactored logic will take that format in consideration
What does this PR do?
On kubernetes a cgroup file will look like
Which was previously ignored. The refactored logic will take that
format in consideration
Motivation
Without this PR the docker daemon check was failing with
Testing Guidelines
Tested on k8s 1.2, will test on 1.3 as well