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

Docker support #844

Merged
merged 14 commits into from
Mar 7, 2014
Merged

Docker support #844

merged 14 commits into from
Mar 7, 2014

Conversation

steeve
Copy link
Contributor

@steeve steeve commented Feb 25, 2014

This PR enables instrumentation on Docker (LXC/cgroups) containers for:

  • Memory
  • CPU
  • Disk

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:

  • make sure dd-agent is part of the docker group (so it can access the socket)
  • rename docker.yaml.example to docker.yaml.

from checks import AgentCheck


USER_HZ = 1000
Copy link
Contributor

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.

@alq666 alq666 added this to the 4.3.x milestone Mar 4, 2014
"cgroup": "memory",
"file": "lxc/{0}/memory.stat",
"metrics": {
"active_anon": ("docker.memory.active_anon", "gauge"),
Copy link
Member

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.*.

@steeve
Copy link
Contributor Author

steeve commented Mar 4, 2014

Updated PR with suggested changes.

def check(self, instance):
tags = instance.get("tags") or []

for container in self._get_containers(instance):
Copy link
Contributor

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

@steeve
Copy link
Contributor Author

steeve commented Mar 5, 2014

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.")
Copy link
Contributor

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

@steeve
Copy link
Contributor Author

steeve commented Mar 7, 2014

@remh added the changes you were asking for. see docker.yaml.example in 3bfe7ec for the rules.

Also, I've removed useless tags, and thus removed the extra http call per container.

@remh
Copy link
Contributor

remh commented Mar 7, 2014

Thanks a lot @steeve !

As discussed I'll do a few small changes before the release.
Thanks again!

remh added a commit that referenced this pull request Mar 7, 2014
@remh remh merged commit b84f9d4 into DataDog:master Mar 7, 2014
@remh remh modified the milestones: 4.2.x, 4.3.x Mar 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants