diff --git a/ansible/roles/collectd/tasks/config.yml b/ansible/roles/collectd/tasks/config.yml index af9417b7e0..2470cd3a5b 100644 --- a/ansible/roles/collectd/tasks/config.yml +++ b/ansible/roles/collectd/tasks/config.yml @@ -21,3 +21,13 @@ dest: "{{ node_config_directory }}/{{ item }}/config.json" with_items: - "collectd" + +- name: Copying over collectd.conf for services + template: + src: "{{ item }}" + dest: "{{ node_config_directory }}/collectd/collectd.conf" + with_first_found: + - "{{ node_custom_config }}/collectd/{{ inventory_hostname }}/collectd.conf" + - "{{ node_custom_config }}/collectd/collectd.conf" + - "{{ node_custom_config }}/collectd.conf" + - "collectd.conf.j2" diff --git a/ansible/roles/collectd/tasks/start.yml b/ansible/roles/collectd/tasks/start.yml index 8675c00eb8..f73067fe03 100644 --- a/ansible/roles/collectd/tasks/start.yml +++ b/ansible/roles/collectd/tasks/start.yml @@ -8,7 +8,6 @@ privileged: True volumes: - "{{ node_config_directory }}/collectd/:{{ container_config_directory }}/:ro" - - "{{node_config_directory }}/collectd/collectd.conf.d/:/etc/collectd/collectd.conf.d/" - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla/" - "/sys/:/sys/:ro" diff --git a/ansible/roles/collectd/templates/collectd.conf.j2 b/ansible/roles/collectd/templates/collectd.conf.j2 new file mode 100644 index 0000000000..6fdc5a333b --- /dev/null +++ b/ansible/roles/collectd/templates/collectd.conf.j2 @@ -0,0 +1,6 @@ +FQDNLookup false +LoadPlugin syslog +LoadPlugin cpu +LoadPlugin interface +LoadPlugin load +LoadPlugin memory diff --git a/ansible/roles/collectd/templates/collectd.json.j2 b/ansible/roles/collectd/templates/collectd.json.j2 index 7d70179270..2599ca6db7 100644 --- a/ansible/roles/collectd/templates/collectd.json.j2 +++ b/ansible/roles/collectd/templates/collectd.json.j2 @@ -1,3 +1,20 @@ +{% set collectd_config = '/etc/collectd/collectd.conf' if kolla_base_distro in ['ubuntu', 'debian'] else '/etc/collectd.conf' %} + { - "command": "/usr/sbin/collectd -f" + "command": "/usr/sbin/collectd -f -C {{ collectd_config }}", + "config_files": [ + { + "source": "{{ container_config_directory }}/collectd.conf", + "dest": "{{ collectd_config }}", + "owner": "collectd", + "perm": "0600" + } + ], + "permissions": [ + { + "path": "/var/log/kolla/collectd", + "owner": "collectd:collectd", + "recurse": true + } + ] }