provide a universal collectd template

The default config for collectd is very different between OS distro.
For example, in ubuntu, collectd read config from "/etc/collect/collect.conf.d".
But in centos, collectd read config from "/etc/collect.d"
We need to provide a universal collectd template
to make it convenient for different distros.

Change-Id: Ib82fcbb923cb32dbafce04e1e639a400d59a4365
Closes-Bug: #1652246
This commit is contained in:
Kuo-tung Kao 2016-12-23 16:39:43 +08:00 committed by Kuo-tung Kao
parent ff666950de
commit 0c29fdfc8f
4 changed files with 34 additions and 2 deletions

View File

@ -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"

View File

@ -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"

View File

@ -0,0 +1,6 @@
FQDNLookup false
LoadPlugin syslog
LoadPlugin cpu
LoadPlugin interface
LoadPlugin load
LoadPlugin memory

View File

@ -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
}
]
}