-
Notifications
You must be signed in to change notification settings - Fork 813
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 support #844
Docker support #844
Conversation
from checks import AgentCheck | ||
|
||
|
||
USER_HZ = 1000 |
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.
This doesn't seem to be used anywhere.
"cgroup": "memory", | ||
"file": "lxc/{0}/memory.stat", | ||
"metrics": { | ||
"active_anon": ("docker.memory.active_anon", "gauge"), |
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.
Let's rename docker.memory.*
to docker.mem.*
to be consistent with the system.mem.*
.
…information from all the running containers. Tags the data with the ContainerId, etc...
Updated PR with suggested changes. |
def check(self, instance): | ||
tags = instance.get("tags") or [] | ||
|
||
for container in self._get_containers(instance): |
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.
Could you log something and use the self.warning() method to display a message in the info page in case there is no containers ?
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.
Sure
Updated changes |
if key in stats: | ||
getattr(self, metric_type)(dd_key, int(stats[key]), tags=container_tags) | ||
else: | ||
self.warning("No containers are running.") |
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 else
statement after a loop will always be executed unless there is break
in your loop
…limit the number of collected containers if no rules are supplied.
Thanks a lot @steeve ! As discussed I'll do a few small changes before the release. |
This PR enables instrumentation on Docker (LXC/cgroups) containers for:
It uses the native Unix socket to communicate with
dockerd
, and thus doesn't need any particular configuration.It supports both old-style and new-style cgroups mountpoints, so it should work out of the box for any system that has cgroups support enabled.
To enable:
dd-agent
is part of thedocker
group (so it can access the socket)docker.yaml.example
todocker.yaml
.