Created
October 28, 2013 14:37
-
-
Save DazWorrall/7197801 to your computer and use it in GitHub Desktop.
Collecting cgroup memory stats using collectd and ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LoadPlugin "table" | |
<Plugin table> | |
{% for vm in running_vms.list_vms %} | |
<Table "/sys/fs/cgroup/memory/libvirt/lxc/{{ vm }}/memory.stat"> | |
Instance "{{ vm }}-memory" | |
Separator " \\n" | |
<Result> | |
Type gauge | |
InstancesFrom 0 | |
ValuesFrom 1 | |
</Result> | |
</Table> | |
{% endfor %} | |
</Plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
hosts: all | |
gather_facts: false | |
tasks: | |
- name: fetch list of running containers | |
virt: command=list_vms state=running uri=lxc:/// | |
register: running_vms | |
- name: setup collectd cgroup config | |
template: src=cgroups.conf.j2 dest=/etc/collectd/conf.d/cgroups.conf mode=0600 owner=root group=root | |
notify: restart collectd | |
handlers: | |
- name: restart collectd | |
service: name=collectd state=restarted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fixed some stuff commented here