diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index 3a53332ecf..f549badc88 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -466,6 +466,9 @@ monasca [monasca-notification:children] monasca +[monasca-persister:children] +monasca + # Storm [storm-worker:children] storm diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index 441a0c9ab5..41c911e838 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -475,6 +475,9 @@ monasca [monasca-notification:children] monasca +[monasca-persister:children] +monasca + # Storm [storm-worker:children] storm diff --git a/ansible/roles/monasca/defaults/main.yml b/ansible/roles/monasca/defaults/main.yml index ba4711dfe0..0dd64bbb73 100644 --- a/ansible/roles/monasca/defaults/main.yml +++ b/ansible/roles/monasca/defaults/main.yml @@ -93,6 +93,16 @@ monasca_services: - "/etc/localtime:/etc/localtime:ro" - "kolla_logs:/var/log/kolla" dimensions: "{{ monasca_notification_dimensions }}" + monasca-persister: + container_name: monasca_persister + group: monasca-persister + enabled: true + image: "{{ monasca_persister_image_full }}" + volumes: + - "{{ node_config_directory }}/monasca-persister/:{{ container_config_directory }}/:ro" + - "/etc/localtime:/etc/localtime:ro" + - "kolla_logs:/var/log/kolla" + dimensions: "{{ monasca_persister_dimensions }}" #################### # Databases @@ -162,6 +172,10 @@ monasca_notification_image: "{{ docker_registry ~ '/' if docker_registry else '' monasca_notification_tag: "{{ monasca_tag }}" monasca_notification_image_full: "{{ monasca_notification_image }}:{{ monasca_notification_tag }}" +monasca_persister_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ monasca_install_type }}-monasca-persister" +monasca_persister_tag: "{{ monasca_tag }}" +monasca_persister_image_full: "{{ monasca_persister_image }}:{{ monasca_persister_tag }}" + monasca_api_dimensions: "{{ default_container_dimensions }}" monasca_log_api_dimensions: "{{ default_container_dimensions }}" monasca_log_transformer_dimensions: "{{ default_container_dimensions }}" @@ -169,6 +183,7 @@ monasca_log_persister_dimensions: "{{ default_container_dimensions }}" monasca_log_metrics_dimensions: "{{ default_container_dimensions }}" monasca_thresh_dimensions: "{{ default_container_dimensions }}" monasca_notification_dimensions: "{{ default_container_dimensions }}" +monasca_persister_dimensions: "{{ default_container_dimensions }}" #################### diff --git a/ansible/roles/monasca/handlers/main.yml b/ansible/roles/monasca/handlers/main.yml index 97f8a0a122..bedb346be9 100644 --- a/ansible/roles/monasca/handlers/main.yml +++ b/ansible/roles/monasca/handlers/main.yml @@ -150,3 +150,23 @@ - config_json.changed | bool or monasca_notification_confs.changed | bool or monasca_notification_container.changed | bool + +- name: Restart monasca-persister container + vars: + service_name: "monasca-persister" + service: "{{ monasca_services[service_name] }}" + config_json: "{{ monasca_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}" + monasca_persister_container: "{{ check_monasca_containers.results|selectattr('item.key', 'equalto', service_name)|first }}" + kolla_docker: + action: "recreate_or_restart_container" + common_options: "{{ docker_common_options }}" + name: "{{ service.container_name }}" + image: "{{ service.image }}" + volumes: "{{ service.volumes }}" + when: + - kolla_action != "config" + - inventory_hostname in groups[service.group] + - service.enabled | bool + - config_json.changed | bool + or monasca_persister_confs.changed | bool + or monasca_persister_container.changed | bool diff --git a/ansible/roles/monasca/tasks/config.yml b/ansible/roles/monasca/tasks/config.yml index b28d444e1e..539385eeb7 100644 --- a/ansible/roles/monasca/tasks/config.yml +++ b/ansible/roles/monasca/tasks/config.yml @@ -236,6 +236,26 @@ notify: - Restart monasca-notification container +- name: Copying over monasca-persister config + vars: + service: "{{ monasca_services['monasca-persister'] }}" + merge_configs: + sources: + - "{{ role_path }}/templates/monasca-persister/{{ item }}.j2" + - "{{ node_custom_config }}/monasca/{{ item }}" + - "{{ node_custom_config }}/monasca/{{ inventory_hostname }}/{{ item }}" + dest: "{{ node_config_directory }}/monasca-persister/{{ item }}" + mode: "0660" + become: true + register: monasca_persister_confs + with_items: + - persister.conf + when: + - inventory_hostname in groups[service['group']] + - service.enabled | bool + notify: + - Restart monasca-persister container + - name: Check monasca containers become: true kolla_docker: diff --git a/ansible/roles/monasca/tasks/deploy.yml b/ansible/roles/monasca/tasks/deploy.yml index 155175f620..7b70dfb259 100644 --- a/ansible/roles/monasca/tasks/deploy.yml +++ b/ansible/roles/monasca/tasks/deploy.yml @@ -10,7 +10,8 @@ inventory_hostname in groups['monasca-log-persister'] or inventory_hostname in groups['monasca-log-metrics'] or inventory_hostname in groups['monasca-thresh'] or - inventory_hostname in groups['monasca-notification'] + inventory_hostname in groups['monasca-notification'] or + inventory_hostname in groups['monasca-persister'] - include_tasks: bootstrap.yml when: inventory_hostname in groups['monasca-api'] @@ -25,4 +26,5 @@ inventory_hostname in groups['monasca-log-persister'] or inventory_hostname in groups['monasca-log-metrics'] or inventory_hostname in groups['monasca-thresh'] or - inventory_hostname in groups['monasca-notification'] + inventory_hostname in groups['monasca-notification'] or + inventory_hostname in groups['monasca-persister'] diff --git a/ansible/roles/monasca/templates/monasca-persister/monasca-persister.json.j2 b/ansible/roles/monasca/templates/monasca-persister/monasca-persister.json.j2 new file mode 100644 index 0000000000..41f9979d97 --- /dev/null +++ b/ansible/roles/monasca/templates/monasca-persister/monasca-persister.json.j2 @@ -0,0 +1,18 @@ +{ + "command": "monasca-persister --config-file /etc/monasca/persister.conf", + "config_files": [ + { + "source": "{{ container_config_directory }}/persister.conf", + "dest": "/etc/monasca/persister.conf", + "owner": "monasca", + "perm": "0600" + } + ], + "permissions": [ + { + "path": "/var/log/kolla/monasca", + "owner": "monasca:kolla", + "recurse": true + } + ] +} diff --git a/ansible/roles/monasca/templates/monasca-persister/persister.conf.j2 b/ansible/roles/monasca/templates/monasca-persister/persister.conf.j2 new file mode 100644 index 0000000000..2610c5b49f --- /dev/null +++ b/ansible/roles/monasca/templates/monasca-persister/persister.conf.j2 @@ -0,0 +1,23 @@ +[DEFAULT] +log_file = monasca-persister.log +log_dir = /var/log/kolla/monasca +debug = {{ monasca_logging_debug }} + +[influxdb] +database_name = {{ monasca_influxdb_name }} +# FIXME(dszumski): This doesn't work with a FQDN so use the VIP directly +ip_address = {{ kolla_internal_vip_address }} +port = {{ monasca_influxdb_http_port }} + +[kafka_alarm_history] +uri = {{ monasca_kafka_servers }} +topic = {{ monasca_alarm_state_transitions_topic }} +num_processors = 1 + +[kafka_metrics] +uri = {{ monasca_kafka_servers }} +topic = {{ monasca_metrics_topic }} +num_processors = 1 + +[zookeeper] +uri = {{ monasca_zookeeper_servers }} diff --git a/releasenotes/notes/add-monasca-persister-c8fdd3d127b2438e.yaml b/releasenotes/notes/add-monasca-persister-c8fdd3d127b2438e.yaml new file mode 100644 index 0000000000..5791b67189 --- /dev/null +++ b/releasenotes/notes/add-monasca-persister-c8fdd3d127b2438e.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Add support for deploying the Monasca Persister process. The + Persister is responsible for reading metrics, alarms and events + from Kafka and storing them in a variety of backends.