Support deploying Monasca Notification engine

The Monasca Notification engine generates alerts such as Slack
notifications from alerts.

Change-Id: I84861d5feefe6b6f38acc4dd71e94c386d40b562
Partially-Implements: blueprint monasca-roles
This commit is contained in:
Doug Szumski 2018-07-17 12:01:23 +01:00
parent b6cce3e3f3
commit da1fa3f578
9 changed files with 115 additions and 2 deletions

View File

@ -464,6 +464,9 @@ monasca
[monasca-thresh:children]
monasca
[monasca-notification:children]
monasca
# Storm
[storm-worker:children]
storm

View File

@ -473,6 +473,9 @@ monasca
[monasca-thresh:children]
monasca
[monasca-notification:children]
monasca
# Storm
[storm-worker:children]
storm

View File

@ -61,6 +61,16 @@ monasca_services:
- "monasca_thresh:/var/lib/monasca-thresh/"
- "kolla_logs:/var/log/kolla"
dimensions: "{{ monasca_thresh_dimensions }}"
monasca-notification:
container_name: monasca_notification
group: monasca-notification
enabled: true
image: "{{ monasca_notification_image_full }}"
volumes:
- "{{ node_config_directory }}/monasca-notification/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla"
dimensions: "{{ monasca_notification_dimensions }}"
####################
# Databases
@ -119,12 +129,17 @@ monasca_thresh_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{
monasca_thresh_tag: "{{ monasca_tag }}"
monasca_thresh_image_full: "{{ monasca_thresh_image }}:{{ monasca_thresh_tag }}"
monasca_notification_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ monasca_install_type }}-monasca-notification"
monasca_notification_tag: "{{ monasca_tag }}"
monasca_notification_image_full: "{{ monasca_notification_image }}:{{ monasca_notification_tag }}"
monasca_api_dimensions: "{{ default_container_dimensions }}"
monasca_log_api_dimensions: "{{ default_container_dimensions }}"
monasca_log_transformer_dimensions: "{{ default_container_dimensions }}"
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 }}"
####################

View File

@ -130,3 +130,23 @@
or monasca_thresh_confs.changed | bool
or monasca_thresh_storm_conf.changed | bool
or monasca_thresh_container.changed | bool
- name: Restart monasca-notification container
vars:
service_name: "monasca-notification"
service: "{{ monasca_services[service_name] }}"
config_json: "{{ monasca_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
monasca_notification_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_notification_confs.changed | bool
or monasca_notification_container.changed | bool

View File

@ -216,6 +216,26 @@
notify:
- Restart monasca-thresh container
- name: Copying over monasca-notification config
vars:
service: "{{ monasca_services['monasca-notification'] }}"
merge_configs:
sources:
- "{{ role_path }}/templates/monasca-notification/{{ item }}.j2"
- "{{ node_custom_config }}/monasca/{{ item }}"
- "{{ node_custom_config }}/monasca/{{ inventory_hostname }}/{{ item }}"
dest: "{{ node_config_directory }}/monasca-notification/{{ item }}"
mode: "0660"
become: true
register: monasca_notification_confs
with_items:
- notification.conf
when:
- inventory_hostname in groups[service['group']]
- service.enabled | bool
notify:
- Restart monasca-notification container
- name: Check monasca containers
become: true
kolla_docker:

View File

@ -9,7 +9,8 @@
inventory_hostname in groups['monasca-log-transformer'] or
inventory_hostname in groups['monasca-log-persister'] or
inventory_hostname in groups['monasca-log-metrics'] or
inventory_hostname in groups['monasca-thresh']
inventory_hostname in groups['monasca-thresh'] or
inventory_hostname in groups['monasca-notification']
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['monasca-api']
@ -23,4 +24,5 @@
inventory_hostname in groups['monasca-log-transformer'] or
inventory_hostname in groups['monasca-log-persister'] or
inventory_hostname in groups['monasca-log-metrics'] or
inventory_hostname in groups['monasca-thresh']
inventory_hostname in groups['monasca-thresh'] or
inventory_hostname in groups['monasca-notification']

View File

@ -0,0 +1,18 @@
{
"command": "monasca-notification /etc/monasca/notification.conf",
"config_files": [
{
"source": "{{ container_config_directory }}/notification.conf",
"dest": "/etc/monasca/notification.conf",
"owner": "monasca",
"perm": "0600"
}
],
"permissions": [
{
"path": "/var/log/kolla/monasca",
"owner": "monasca:kolla",
"recurse": true
}
]
}

View File

@ -0,0 +1,25 @@
[DEFAULT]
log_file = monasca-notification.log
log_dir = /var/log/kolla/monasca
debug = {{ monasca_logging_debug }}
[kafka]
url = {{ monasca_kafka_servers }}
alarm_topic = {{ monasca_alarm_state_transitions_topic }}
notification_topic = {{ monasca_alarm_notifications_topic }}
notification_retry_topic = {{ monasca_alarm_notifications_retry_topic }}
periodic = {{ monasca_periodic_notifications_period }}:{{ monasca_periodic_notifications_topic }}
[mysql]
host = {{ database_address }}
port = {{ database_port }}
user = {{ monasca_database_user }}
passwd = {{ monasca_database_password }}
db = {{ monasca_database_name }}
[statsd]
# TODO(dszumski): Enable when statsd is deployed
enable = false
[zookeeper]
url = {{ monasca_zookeeper_servers }}

View File

@ -0,0 +1,7 @@
---
features:
- |
Add support for deploying the Monasca Notification service. The
Notification service is responsible for notifiying users when
an alert, as defined via the Monasca API, is generated by the
Monasca Thresh topology.