Skip to content
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

ZBX_NOTSUPPORTED: Cannot open cpuacct.stat file on AWS ECS #85

Open
ThomasVdBerge opened this issue Jan 2, 2018 · 7 comments
Open

ZBX_NOTSUPPORTED: Cannot open cpuacct.stat file on AWS ECS #85

ThomasVdBerge opened this issue Jan 2, 2018 · 7 comments

Comments

@ThomasVdBerge
Copy link

ThomasVdBerge commented Jan 2, 2018

Having an issue whit monitoring of docker containers that were started by Amazon ECS.
I am using the dockbix xxl agent

When I check the location of the file it does indeed not exist (the folder). However, the docker container is running when checked via docker ps.

Docker containers that were started on the same server, but manually (so not with ECS), are being monitored fine

This is the error that is being thrown by the agent

    15:20180102:151403.523 Docker's socket response: {"Id":"53f8b5a76026c0484948dbb720991f771106d32adca9eb75a88ce5d3afa78f0e","Created":"2 (and a lot more info....)
    15:20180102:151403.523 Item [Id] found in the received JSON object: 53f8b5a76026c0484948dbb720991f771106d32adca9eb75a88ce5d3afa78f0e
    15:20180102:151403.523 zbx_module_docker_inspect_exec OK: 53f8b5a76026c0484948dbb720991f771106d32adca9eb75a88ce5d3afa78f0e
    15:20180102:151403.523 Metric source file: /rootfs/cgroup/cpuacct/docker/53f8b5a76026c0484948dbb720991f771106d32adca9eb75a88ce5d3afa78f0e/cpuacct.stat
    15:20180102:151403.523 Cannot open metric file: '/rootfs/cgroup/cpuacct/docker/53f8b5a76026c0484948dbb720991f771106d32adca9eb75a88ce5d3afa78f0e/cpuacct.stat', container doesn't run
    15:20180102:151403.523 Sending back [0]```
@ThomasVdBerge
Copy link
Author

ThomasVdBerge commented Jan 2, 2018

Seems the problem is the fact that Amazon created their own 'folder structure'for storing the cgroup stuff.

/rootfs/cgroup/cpuacct/ecs/48cb34f5-cd39-4d59-9bb9-89f3c1611afd/53f8b5a76026c0484948dbb720991f771106d32adca9eb75a88ce5d3afa78f0e

Instead of

/rootfs/cgroup/cpuacct/docker/53f8b5a76026c0484948dbb720991f771106d32adca9eb75a88ce5d3afa78f0e/cpuacct.stat

So the folder is different (ecs <> docker) and the task definition is used in the folder path.

@jangaraj
Copy link
Member

jangaraj commented Jan 2, 2018

Valid point, Thomas. Module tries to detect proper cgroup dir location only once, during module initialization. It's not prepared for this ECS case.

@ThomasVdBerge
Copy link
Author

I think this can be resolved by a small fix.

For ECS, docker inspect has the following value set:

"CgroupParent": "/ecs/48cb34f5-cd39-4d59-9bb9-89f3c1611afd",

for Non ECS, this value is set:

"CgroupParent": "",

So technically, taking the CgroupParent folder into account should be sufficient

@jangaraj
Copy link
Member

jangaraj commented Jan 2, 2018

Yes, 👍 It looks like ECS uses:

--cgroup-parent - Optional parent cgroup for the container

It will need additional docker inspect call.

@Introozzo
Copy link

Hi everyone!
Fixed
The patch is for cgroup-parent branch. It just adds empty parent folder to the cgroup acct files path search list. It seems its quite common to put parent cgroups under root path in case if custom cgroup is used manually (not with k8s etc).

cgroup_parent.patch.zip

@dodikvt
Copy link

dodikvt commented Feb 14, 2020

Hi,
bit confused but is there a working solution for monitoring AWS ECS docker containers started with CgroupParent option ?

@joaofsoares
Copy link

Hi lads,

Did you try use ECS_ENABLE_TASK_CPU_MEM_LIMIT=false on your ecs.config file?
It changes the way your agent creates the path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants