Skip to content

Commit ca34963

Browse files
authored
Merge pull request #140 from stackhpc/feature/monitoring_sp2_victoria
Feature/monitoring sp2 victoria
2 parents 5303c6e + 1235fa9 commit ca34963

28 files changed

+430
-192
lines changed

ansible/group_vars/all.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ enable_searchlight: "no"
684684
enable_senlin: "no"
685685
enable_skydive: "no"
686686
enable_solum: "no"
687-
enable_storm: "{{ enable_monasca | bool }}"
687+
enable_storm: "{{ enable_monasca | bool and monasca_enable_alerting_pipeline | bool }}"
688688
enable_swift: "no"
689689
enable_swift_s3api: "no"
690690
enable_swift_recon: "no"
@@ -718,6 +718,13 @@ enable_destroy_images: "no"
718718
####################
719719
# Monasca options
720720
####################
721+
monasca_enable_alerting_pipeline: True
722+
723+
# Send logs from the control plane to the Monasca API. Monasca will then persist
724+
# them in Elasticsearch. If this is disabled, control plane logs will be sent
725+
# directly to Elasticsearch.
726+
monasca_ingest_control_plane_logs: True
727+
721728
monasca_api_admin_base_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ monasca_api_port }}"
722729
monasca_api_internal_base_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn | put_address_in_context('url') }}:{{ monasca_api_port }}"
723730
monasca_api_public_base_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn | put_address_in_context('url') }}:{{ monasca_api_port }}"
@@ -1119,6 +1126,11 @@ infuxdb_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn | p
11191126
#################
11201127
kafka_datadir_volume: "kafka"
11211128

1129+
# The number of brokers in a Kafka cluster. This is used for automatically
1130+
# setting quantities such as topic replicas and it is not recommended to
1131+
# change it unless you know what you are doing.
1132+
kafka_broker_count: "{{ groups['kafka'] | length }}"
1133+
11221134
#########################
11231135
# Internal Image options
11241136
#########################

ansible/monasca_cleanup.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
- name: Cleanup unused Monasca services
3+
hosts:
4+
- monasca-api
5+
- monasca-grafana
6+
- monasca-log-transformer
7+
- monasca-log-persister
8+
- monasca-log-metrics
9+
- monasca-thresh
10+
- monasca-notification
11+
- monasca-persister
12+
roles:
13+
- { role: monasca,
14+
tags: monasca }
15+
16+
- name: Cleanup unused Storm services
17+
hosts:
18+
- storm-worker
19+
- storm-nimbus
20+
roles:
21+
- { role: storm,
22+
tags: storm }

ansible/roles/common/tasks/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
log_direct_to_elasticsearch: >-
107107
{{ ( enable_elasticsearch | bool or
108108
( elasticsearch_address != kolla_internal_vip_address )) and
109-
not enable_monasca | bool }}
109+
( not enable_monasca | bool or not monasca_ingest_control_plane_logs | bool ) }}
110110
fluentd_version: "{{ fluentd_labels.images.0.ContainerConfig.Labels.fluentd_version | default('0.12') }}"
111111
# Inputs
112112
fluentd_input_files: "{{ default_input_files | customise_fluentd(customised_input_files) }}"
@@ -143,7 +143,7 @@
143143
- name: "conf/output/01-es.conf.j2"
144144
enabled: "{{ log_direct_to_elasticsearch }}"
145145
- name: "conf/output/02-monasca.conf.j2"
146-
enabled: "{{ enable_monasca | bool }}"
146+
enabled: "{{ enable_monasca | bool and monasca_ingest_control_plane_logs | bool }}"
147147
customised_output_files: "{{ find_custom_fluentd_outputs.files | map(attribute='path') | list }}"
148148
template:
149149
src: "td-agent.conf.j2"

ansible/roles/common/templates/conf/filter/00-record_transformer.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
</record>
7272
</filter>
7373

74-
{% if enable_monasca | bool %}
74+
{% if enable_monasca | bool and monasca_ingest_control_plane_logs | bool %}
7575
# Kolla configures Fluentd to extract timestamps from OpenStack service
7676
# logs, however these timestamps are not saved in the event and are not
7777
# forwarded to Monasca. Here we save the timestamp which has been

ansible/roles/common/templates/conf/output/00-local.conf.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
buffer_type file
3737
buffer_path /var/lib/fluentd/data/elasticsearch.buffer/{{ syslog_swift_facility }}.*
3838
</store>
39-
{% elif enable_monasca | bool %}
39+
{% elif enable_monasca | bool and monasca_ingest_control_plane_logs | bool %}
4040
<store>
4141
@type monasca
4242
keystone_url {{ keystone_internal_url }}
@@ -98,7 +98,7 @@
9898
buffer_type file
9999
buffer_path /var/lib/fluentd/data/elasticsearch.buffer/{{ syslog_haproxy_facility }}.*
100100
</store>
101-
{% elif enable_monasca | bool %}
101+
{% elif enable_monasca | bool and monasca_ingest_control_plane_logs | bool %}
102102
<store>
103103
@type monasca
104104
keystone_url {{ keystone_internal_url }}
@@ -158,7 +158,7 @@
158158
buffer_type file
159159
buffer_path /var/lib/fluentd/data/elasticsearch.buffer/{{ syslog_glance_tls_proxy_facility }}.*
160160
</store>
161-
{% elif enable_monasca | bool %}
161+
{% elif enable_monasca | bool and monasca_ingest_control_plane_logs | bool %}
162162
<store>
163163
@type monasca
164164
keystone_url {{ keystone_internal_url }}
@@ -219,7 +219,7 @@
219219
buffer_type file
220220
buffer_path /var/lib/fluentd/data/elasticsearch.buffer/{{ syslog_neutron_tls_proxy_facility }}.*
221221
</store>
222-
{% elif enable_monasca | bool %}
222+
{% elif enable_monasca | bool and monasca_ingest_control_plane_logs | bool %}
223223
<store>
224224
@type monasca
225225
keystone_url {{ keystone_internal_url }}

ansible/roles/elasticsearch/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ elasticsearch_curator_dry_run: false
5959

6060
# Index prefix pattern. Any indices matching this regex will
6161
# be managed by Curator.
62-
elasticsearch_curator_index_pattern: "^{{ 'monasca' if enable_monasca|bool else kibana_log_prefix }}-.*"
62+
elasticsearch_curator_index_pattern: "^{{ '(monasca|' + kibana_log_prefix + ')' if enable_monasca|bool else kibana_log_prefix }}-.*"
6363

6464
# Duration after which an index is staged for deletion. This is
6565
# implemented by closing the index. Whilst in this state the index

ansible/roles/kafka/defaults/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ kafka_cluster_name: "kolla_kafka"
2020
kafka_log_dir: "/var/log/kolla/kafka"
2121
kafka_heap_opts: "-Xmx1G -Xms1G"
2222
kafka_zookeeper: "{% for host in groups['zookeeper'] %}{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ zookeeper_client_port }}{% if not loop.last %},{% endif %}{% endfor %}"
23-
kafka_broker_count: "{{ groups['kafka'] | length }}"
2423

2524
####################
2625
# Docker

ansible/roles/monasca/defaults/main.yml

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ monasca_services:
2020
mode: "http"
2121
external: true
2222
port: "{{ monasca_api_port }}"
23+
# NOTE(dszumski): We can remove log_transformer and all other references after the
24+
# Wallaby release
2325
monasca-log-transformer:
2426
container_name: monasca_log_transformer
2527
group: monasca-log-transformer
26-
enabled: true
28+
enabled: false
2729
image: "{{ monasca_logstash_image_full }}"
2830
volumes: "{{ monasca_log_transformer_default_volumes + monasca_log_transformer_extra_volumes }}"
2931
dimensions: "{{ monasca_log_transformer_dimensions }}"
@@ -37,21 +39,21 @@ monasca_services:
3739
monasca-log-metrics:
3840
container_name: monasca_log_metrics
3941
group: monasca-log-metrics
40-
enabled: true
42+
enabled: "{{ monasca_enable_log_metrics_service | bool }}"
4143
image: "{{ monasca_logstash_image_full }}"
4244
volumes: "{{ monasca_log_metrics_default_volumes + monasca_log_metrics_extra_volumes }}"
4345
dimensions: "{{ monasca_log_metrics_dimensions }}"
4446
monasca-thresh:
4547
container_name: monasca_thresh
4648
group: monasca-thresh
47-
enabled: true
49+
enabled: "{{ monasca_enable_alerting_pipeline | bool }}"
4850
image: "{{ monasca_thresh_image_full }}"
4951
volumes: "{{ monasca_thresh_default_volumes + monasca_thresh_extra_volumes }}"
5052
dimensions: "{{ monasca_thresh_dimensions }}"
5153
monasca-notification:
5254
container_name: monasca_notification
5355
group: monasca-notification
54-
enabled: true
56+
enabled: "{{ monasca_enable_alerting_pipeline | bool }}"
5557
image: "{{ monasca_notification_image_full }}"
5658
volumes: "{{ monasca_notification_default_volumes + monasca_notification_extra_volumes }}"
5759
dimensions: "{{ monasca_notification_dimensions }}"
@@ -123,6 +125,11 @@ monasca_influxdb_retention_policy:
123125
####################
124126
# Monasca
125127
####################
128+
129+
# NOTE(dszumski): This can be removed in the Xena cycle when the
130+
# log metrics service is removed
131+
monasca_enable_log_metrics_service: False
132+
126133
monasca_kafka_servers: "{% for host in groups['kafka'] %}{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ kafka_port }}{% if not loop.last %},{% endif %}{% endfor %}"
127134
monasca_zookeeper_servers: "{% for host in groups['zookeeper'] %}{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ zookeeper_client_port }}{% if not loop.last %},{% endif %}{% endfor %}"
128135
monasca_memcached_servers: "{% for host in groups['memcached'] %}{{ 'api' | kolla_address(host) | put_address_in_context('memcache') }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}"
@@ -131,7 +138,22 @@ monasca_storm_nimbus_servers: "{% for host in groups['storm-nimbus'] %}'{{ 'api'
131138
# NOTE(dszumski): Only one NTP server is currently supported by the Monasca Agent plugin
132139
monasca_ntp_server: "{{ external_ntp_servers | first }}"
133140

134-
# Kafka topics used by Monasca services
141+
# The default number of Kafka topic partitions. This effectively limits
142+
# the maximum number of workers per topic, counted over all nodes in the
143+
# Monasca deployment. For example, if you have a 3 node Monasca
144+
# deployment, you will by default have 3 instances of Monasca Persister,
145+
# with each instance having 2 workers by default for the metrics topic.
146+
# In this case, each worker on the metrics topic will be assigned 5
147+
# partitions of the metrics topic. If you increase the worker or instance
148+
# count, you may need to increase the partition count to ensure that all
149+
# workers can get a share of the work.
150+
monasca_default_topic_partitions: 30
151+
152+
# The default number of topic replicas. Generally you should not change
153+
# this.
154+
monasca_default_topic_replication_factor: "{{ kafka_broker_count if kafka_broker_count|int < 3 else 3 }}"
155+
156+
# Kafka topic names used by Monasca services
135157
monasca_metrics_topic: "metrics"
136158
monasca_raw_logs_topic: "logs"
137159
monasca_transformed_logs_topic: "transformed-logs"
@@ -141,6 +163,47 @@ monasca_alarm_notifications_topic: "alarm-notifications"
141163
monasca_alarm_notifications_retry_topic: "retry-notifications"
142164
monasca_periodic_notifications_topic: "60-seconds-notifications"
143165

166+
# Kafka topic configuration. Most users will not need to modify these
167+
# settings, however for deployments where resources are tightly
168+
# constrained, or very large deployments where there are many parallel
169+
# workers, it is worth considering changing them. Note that if you do
170+
# change these settings, then you will need to manually remove each
171+
# topic from the Kafka deployment for the change to take effect when
172+
# the Monasca service is reconfigured.
173+
monasca_all_topics:
174+
- name: "{{ monasca_metrics_topic }}"
175+
partitions: "{{ monasca_default_topic_partitions }}"
176+
replication_factor: "{{ monasca_default_topic_replication_factor }}"
177+
enabled: True
178+
- name: "{{ monasca_raw_logs_topic }}"
179+
partitions: "{{ monasca_default_topic_partitions }}"
180+
replication_factor: "{{ monasca_default_topic_replication_factor }}"
181+
enabled: True
182+
- name: "{{ monasca_transformed_logs_topic }}"
183+
partitions: "{{ monasca_default_topic_partitions }}"
184+
replication_factor: "{{ monasca_default_topic_replication_factor }}"
185+
enabled: False
186+
- name: "{{ monasca_events_topic }}"
187+
partitions: "{{ monasca_default_topic_partitions }}"
188+
replication_factor: "{{ monasca_default_topic_replication_factor }}"
189+
enabled: "{{ monasca_enable_alerting_pipeline | bool }}"
190+
- name: "{{ monasca_alarm_state_transitions_topic }}"
191+
partitions: "{{ monasca_default_topic_partitions }}"
192+
replication_factor: "{{ monasca_default_topic_replication_factor }}"
193+
enabled: "{{ monasca_enable_alerting_pipeline | bool }}"
194+
- name: "{{ monasca_alarm_notifications_topic }}"
195+
partitions: "{{ monasca_default_topic_partitions }}"
196+
replication_factor: "{{ monasca_default_topic_replication_factor }}"
197+
enabled: "{{ monasca_enable_alerting_pipeline | bool }}"
198+
- name: "{{ monasca_alarm_notifications_retry_topic }}"
199+
partitions: "{{ monasca_default_topic_partitions }}"
200+
replication_factor: "{{ monasca_default_topic_replication_factor }}"
201+
enabled: "{{ monasca_enable_alerting_pipeline | bool }}"
202+
- name: "{{ monasca_periodic_notifications_topic }}"
203+
partitions: "{{ monasca_default_topic_partitions }}"
204+
replication_factor: "{{ monasca_default_topic_replication_factor }}"
205+
enabled: "{{ monasca_enable_alerting_pipeline | bool }}"
206+
144207
# NOTE(dszumski): Due to the way monasca-notification is currently
145208
# implemented it is not recommended to change this period.
146209
monasca_periodic_notifications_period: 60

ansible/roles/monasca/handlers/main.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,6 @@
1414
when:
1515
- kolla_action != "config"
1616

17-
- name: Restart monasca-log-transformer container
18-
vars:
19-
service_name: "monasca-log-transformer"
20-
service: "{{ monasca_services[service_name] }}"
21-
become: true
22-
kolla_docker:
23-
action: "recreate_or_restart_container"
24-
common_options: "{{ docker_common_options }}"
25-
name: "{{ service.container_name }}"
26-
image: "{{ service.image }}"
27-
volumes: "{{ service.volumes }}"
28-
dimensions: "{{ service.dimensions }}"
29-
when:
30-
- kolla_action != "config"
31-
3217
- name: Restart monasca-log-persister container
3318
vars:
3419
service_name: "monasca-log-persister"

ansible/roles/monasca/tasks/bootstrap.yml

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,47 @@
6161
delegate_to: "{{ groups['influxdb'][0] }}"
6262
when: monasca_influxdb_name not in monasca_influxdb_database.stdout_lines
6363

64-
# NOTE(dszumski): The Monasca APIs write logs and messages to Kafka. Since
65-
# Kafka has automatic topic generation enabled by default we don't need to
66-
# create topics here.
64+
# NOTE(dszumski): Although we can take advantage of automatic topic
65+
# creation in Kafka, creating the topics manually allows unique settings
66+
# to be used per topic, rather than the defaults. It also avoids an edge
67+
# case where services on multiple nodes may race to create topics, and
68+
# paves the way for enabling things like compression on a per topic basis.
69+
- name: List monasca kafka topics
70+
become: true
71+
command: >
72+
docker exec kafka /opt/kafka/bin/kafka-topics.sh
73+
--zookeeper localhost
74+
--list
75+
register: kafka_topics
76+
run_once: True
77+
delegate_to: "{{ groups['kafka'][0] }}"
78+
79+
- name: Create monasca kafka topics if they don't exist
80+
become: true
81+
command: >
82+
docker exec kafka /opt/kafka/bin/kafka-topics.sh
83+
--create
84+
--topic {{ item.name }}
85+
--partitions {{ item.partitions }}
86+
--replication-factor {{ item.replication_factor }}
87+
--zookeeper localhost
88+
run_once: True
89+
delegate_to: "{{ groups['kafka'][0] }}"
90+
when:
91+
- item.name not in kafka_topics.stdout_lines
92+
- item.enabled | bool
93+
with_items: "{{ monasca_all_topics }}"
94+
95+
- name: Remove monasca kafka topics for disabled services
96+
become: true
97+
command: >
98+
docker exec kafka /opt/kafka/bin/kafka-topics.sh
99+
--delete
100+
--topic "{{ item.name }}"
101+
--zookeeper localhost
102+
run_once: True
103+
delegate_to: "{{ groups['kafka'][0] }}"
104+
when:
105+
- item.name in kafka_topics.stdout_lines
106+
- not item.enabled | bool
107+
with_items: "{{ monasca_all_topics }}"

0 commit comments

Comments
 (0)