Added telegraf role
Added ansible role to deploy telegraf Roll out telegraf to all nodes Introduce parameter to toggle deployment of performance monitoring Co-Authored-By: zhubingbing <zhubingbing10@gmail.com> Change-Id: Ia09b20ce65bf557c1a1030eda99df5cc88debd01 Partially-Implements: Blueprint performance-monitoring
This commit is contained in:
parent
d3302a7e69
commit
56af4ef202
@ -263,6 +263,7 @@ enable_rally: "no"
|
|||||||
enable_sahara: "no"
|
enable_sahara: "no"
|
||||||
enable_senlin: "no"
|
enable_senlin: "no"
|
||||||
enable_swift: "no"
|
enable_swift: "no"
|
||||||
|
enable_telegraf: "no"
|
||||||
enable_tempest: "no"
|
enable_tempest: "no"
|
||||||
enable_watcher: "no"
|
enable_watcher: "no"
|
||||||
|
|
||||||
|
@ -23,6 +23,9 @@ compute
|
|||||||
[kibana:children]
|
[kibana:children]
|
||||||
control
|
control
|
||||||
|
|
||||||
|
[telegraf:children]
|
||||||
|
monitoring
|
||||||
|
|
||||||
[elasticsearch:children]
|
[elasticsearch:children]
|
||||||
control
|
control
|
||||||
|
|
||||||
|
@ -44,6 +44,9 @@ monitoring
|
|||||||
[kibana:children]
|
[kibana:children]
|
||||||
control
|
control
|
||||||
|
|
||||||
|
[telegraf:children]
|
||||||
|
monitoring
|
||||||
|
|
||||||
[elasticsearch:children]
|
[elasticsearch:children]
|
||||||
control
|
control
|
||||||
|
|
||||||
|
18
ansible/roles/telegraf/defaults/main.yml
Normal file
18
ansible/roles/telegraf/defaults/main.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
project_name: "telegraf"
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Docker
|
||||||
|
####################
|
||||||
|
telegraf_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-telegraf"
|
||||||
|
telegraf_tag: "{{ openstack_release }}"
|
||||||
|
telegraf_image_full: "{{ telegraf_image }}:{{ telegraf_tag }}"
|
||||||
|
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Protocols
|
||||||
|
####################
|
||||||
|
elasticsearch_proto: "http"
|
||||||
|
haproxy_proto: "http"
|
||||||
|
influxdb_proto: "http"
|
||||||
|
rabbitmq_proto: "http"
|
3
ansible/roles/telegraf/meta/main.yml
Normal file
3
ansible/roles/telegraf/meta/main.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
dependencies:
|
||||||
|
- { role: common }
|
26
ansible/roles/telegraf/tasks/config.yml
Normal file
26
ansible/roles/telegraf/tasks/config.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
- name: Ensuring config directories exist
|
||||||
|
file:
|
||||||
|
path: "{{ node_config_directory }}/{{ item }}"
|
||||||
|
state: "directory"
|
||||||
|
recurse: yes
|
||||||
|
with_items:
|
||||||
|
- "telegraf"
|
||||||
|
- "telegraf/config"
|
||||||
|
|
||||||
|
- name: Copying over default config.json files
|
||||||
|
template:
|
||||||
|
src: "telegraf.json.j2"
|
||||||
|
dest: "{{ node_config_directory }}/telegraf/config.json"
|
||||||
|
|
||||||
|
- name: Copying over telegraf config file
|
||||||
|
template:
|
||||||
|
src: "telegraf.conf.j2"
|
||||||
|
dest: "{{ node_config_directory }}/telegraf/telegraf.conf"
|
||||||
|
|
||||||
|
- name: Copying over telegraf plugin files
|
||||||
|
copy:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: "{{ node_config_directory }}/telegraf/config"
|
||||||
|
with_fileglob:
|
||||||
|
- "{{ role_path }}/templates/config/*.conf"
|
4
ansible/roles/telegraf/tasks/deploy.yml
Normal file
4
ansible/roles/telegraf/tasks/deploy.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
- include: config.yml
|
||||||
|
|
||||||
|
- include: start.yml
|
42
ansible/roles/telegraf/tasks/do_reconfigure.yml
Normal file
42
ansible/roles/telegraf/tasks/do_reconfigure.yml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
- name: Ensuring the containers up
|
||||||
|
kolla_docker:
|
||||||
|
name: "telegraf"
|
||||||
|
action: "get_container_state"
|
||||||
|
register: container_state
|
||||||
|
failed_when: container_state.Running == false
|
||||||
|
|
||||||
|
- include: config.yml
|
||||||
|
|
||||||
|
- name: Check the configs
|
||||||
|
command: docker exec telegraf /usr/local/bin/kolla_set_configs --check
|
||||||
|
changed_when: false
|
||||||
|
failed_when: false
|
||||||
|
register: check_results
|
||||||
|
|
||||||
|
# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS'
|
||||||
|
# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE',
|
||||||
|
# just remove the container and start again
|
||||||
|
- name: Containers config strategy
|
||||||
|
kolla_docker:
|
||||||
|
name: "telegraf"
|
||||||
|
action: "get_container_env"
|
||||||
|
register: container_envs
|
||||||
|
|
||||||
|
- name: Remove the containers
|
||||||
|
kolla_docker:
|
||||||
|
name: "telegraf"
|
||||||
|
action: "remove_container"
|
||||||
|
register: remove_containers
|
||||||
|
when:
|
||||||
|
- config_strategy == "COPY_ONCE"
|
||||||
|
|
||||||
|
- include: start.yml
|
||||||
|
when: remove_containers.changed
|
||||||
|
|
||||||
|
- name: Restart containers
|
||||||
|
kolla_docker:
|
||||||
|
name: "telegraf"
|
||||||
|
action: "restart_container"
|
||||||
|
when:
|
||||||
|
- config_strategy == 'COPY_ALWAYS'
|
2
ansible/roles/telegraf/tasks/main.yml
Normal file
2
ansible/roles/telegraf/tasks/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- include: "{{ action }}.yml"
|
6
ansible/roles/telegraf/tasks/pull.yml
Normal file
6
ansible/roles/telegraf/tasks/pull.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- name: Pulling telegraf image
|
||||||
|
kolla_docker:
|
||||||
|
action: "pull_image"
|
||||||
|
common_options: "{{ docker_common_options }}"
|
||||||
|
image: "{{ telegraf_image_full }}"
|
2
ansible/roles/telegraf/tasks/reconfigure.yml
Normal file
2
ansible/roles/telegraf/tasks/reconfigure.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
- include: do_reconfigure.yml
|
19
ansible/roles/telegraf/tasks/start.yml
Normal file
19
ansible/roles/telegraf/tasks/start.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
- name: Starting telegraf container
|
||||||
|
kolla_docker:
|
||||||
|
action: "start_container"
|
||||||
|
common_options: "{{ docker_common_options }}"
|
||||||
|
image: "{{ telegraf_image_full }}"
|
||||||
|
name: "telegraf"
|
||||||
|
environment:
|
||||||
|
HOST_PROC: "/rootfs/proc"
|
||||||
|
HOST_SYS: "/rootfs/sys"
|
||||||
|
volumes:
|
||||||
|
- "{{ node_config_directory }}/telegraf/:{{ container_config_directory }}/:ro"
|
||||||
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
|
- "kolla_logs:/var/log/kolla/"
|
||||||
|
- "/sys:/rootfs/sys:ro"
|
||||||
|
- "/proc:/rootfs/proc:ro"
|
||||||
|
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||||
|
- "haproxy_socket:/var/lib/kolla/haproxy/:rw"
|
||||||
|
pid_mode: "host"
|
4
ansible/roles/telegraf/tasks/upgrade.yml
Normal file
4
ansible/roles/telegraf/tasks/upgrade.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
- include: config.yml
|
||||||
|
|
||||||
|
- include: start.yml
|
55
ansible/roles/telegraf/templates/telegraf.conf.j2
Normal file
55
ansible/roles/telegraf/templates/telegraf.conf.j2
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
[global_tags]
|
||||||
|
[agent]
|
||||||
|
interval = "10s"
|
||||||
|
round_interval = true
|
||||||
|
metric_batch_size = 1000
|
||||||
|
metric_buffer_limit = 10000
|
||||||
|
collection_jitter = "0s"
|
||||||
|
flush_interval = "10s"
|
||||||
|
flush_jitter = "0s"
|
||||||
|
debug = false
|
||||||
|
quiet = false
|
||||||
|
hostname = ""
|
||||||
|
omit_hostname = false
|
||||||
|
[[outputs.influxdb]]
|
||||||
|
urls = [{% for host in groups['influxdb'] %}"{{ influxdb_proto }}://{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address']}}:{{ influxdb_http_port }}"{% if not loop.last %},{% endif %}{% endfor %}]
|
||||||
|
database = "telegraf" # required
|
||||||
|
retention_policy = "default"
|
||||||
|
write_consistency = "any"
|
||||||
|
timeout = "5s"
|
||||||
|
[[inputs.filestat]]
|
||||||
|
files = ["/var/log/kolla/**.log"]
|
||||||
|
[[inputs.cpu]]
|
||||||
|
percpu = true
|
||||||
|
totalcpu = true
|
||||||
|
fielddrop = ["time_*"]
|
||||||
|
[[inputs.disk]]
|
||||||
|
ignore_fs = ["tmpfs", "devtmpfs"]
|
||||||
|
[[inputs.diskio]]
|
||||||
|
[[inputs.kernel]]
|
||||||
|
[[inputs.mem]]
|
||||||
|
[[inputs.processes]]
|
||||||
|
[[inputs.swap]]
|
||||||
|
[[inputs.system]]
|
||||||
|
[[inputs.net]]
|
||||||
|
interfaces = []
|
||||||
|
{% if enable_haproxy | bool %}
|
||||||
|
[[inputs.haproxy]]
|
||||||
|
servers = ["{{ haproxy_proto }}://{{ haproxy_user }}:{{ haproxy_password }}@{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ haproxy_stats_port }}"]
|
||||||
|
{% endif %}
|
||||||
|
{% if enable_memcached | bool %}
|
||||||
|
[[inputs.memcached]]
|
||||||
|
servers = ["{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ memcached_port }}"]
|
||||||
|
{% endif %}
|
||||||
|
{% if enable_elasticsearch | bool %}
|
||||||
|
[[inputs.elasticsearch]]
|
||||||
|
servers = ["{{ elasticsearch_proto }}://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ elasticsearch_port }}"]
|
||||||
|
local = true
|
||||||
|
cluster_health = true
|
||||||
|
{% endif %}
|
||||||
|
{% if inventory_hostname in groups['rabbitmq'] %}
|
||||||
|
[[inputs.rabbitmq]]
|
||||||
|
url = "{{ rabbitmq_proto }}://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}:{{ rabbitmq_management_port }}"
|
||||||
|
username = "{{ rabbitmq_user }}"
|
||||||
|
password = "{{ rabbitmq_password }}"
|
||||||
|
{% endif %}
|
17
ansible/roles/telegraf/templates/telegraf.json.j2
Normal file
17
ansible/roles/telegraf/templates/telegraf.json.j2
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"command": "telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d/",
|
||||||
|
"config_files": [
|
||||||
|
{
|
||||||
|
"source": "{{ container_config_directory }}/telegraf.conf",
|
||||||
|
"dest": "/etc/telegraf/telegraf.conf",
|
||||||
|
"owner": "telegraf",
|
||||||
|
"perm": "0600"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "{{ container_config_directory }}/config/*",
|
||||||
|
"dest": "/etc/telegraf/telegraf.d/",
|
||||||
|
"owner": "telegraf",
|
||||||
|
"perm": "0600"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -28,6 +28,14 @@
|
|||||||
tags: influxdb,
|
tags: influxdb,
|
||||||
when: enable_influxdb | bool }
|
when: enable_influxdb | bool }
|
||||||
|
|
||||||
|
- hosts:
|
||||||
|
- telegraf
|
||||||
|
serial: '{{ "30%" if action == "upgrade" else "0" }}'
|
||||||
|
roles:
|
||||||
|
- { role: telegraf,
|
||||||
|
tags: telegraf,
|
||||||
|
when: enable_telegraf | bool }
|
||||||
|
|
||||||
- hosts: haproxy
|
- hosts: haproxy
|
||||||
serial: '{{ "30%" if action == "upgrade" else "0" }}'
|
serial: '{{ "30%" if action == "upgrade" else "0" }}'
|
||||||
roles:
|
roles:
|
||||||
|
@ -137,6 +137,7 @@ kolla_internal_vip_address: "10.10.10.254"
|
|||||||
#enable_rally: "no"
|
#enable_rally: "no"
|
||||||
#enable_senlin: "no"
|
#enable_senlin: "no"
|
||||||
#enable_swift: "no"
|
#enable_swift: "no"
|
||||||
|
#enable_telegraf: "no"
|
||||||
#enable_tempest: "no"
|
#enable_tempest: "no"
|
||||||
#enable_watcher: "no"
|
#enable_watcher: "no"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user