Merge "Add support for deploying Monasca Grafana" into stable/rocky

This commit is contained in:
Zuul 2019-06-04 15:37:16 +00:00 committed by Gerrit Code Review
commit 77bb1da341
16 changed files with 227 additions and 6 deletions

View File

@ -254,6 +254,7 @@ monasca_api_port: "8070"
monasca_log_api_port: "5607"
monasca_agent_forwarder_port: "17123"
monasca_agent_statsd_port: "8125"
monasca_grafana_server_port: "3001"
mongodb_port: "27017"
mongodb_web_port: "28017"

View File

@ -465,6 +465,9 @@ monasca-agent
[monasca-api:children]
monasca
[monasca-grafana:children]
monasca
[monasca-log-api:children]
monasca

View File

@ -474,6 +474,9 @@ monasca-agent
[monasca-api:children]
monasca
[monasca-grafana:children]
monasca
[monasca-log-api:children]
monasca

View File

@ -547,6 +547,33 @@
- haproxy_stat.find('monasca_log_api_external') == -1
- "host_running_haproxy == 'None'"
- name: Checking free port for Monasca Grafana API internal HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"
port: "{{ monasca_grafana_server_port }}"
connect_timeout: 1
timeout: 1
state: stopped
when:
- enable_monasca | bool
- inventory_hostname in groups['haproxy']
- haproxy_stat.find('monasca_grafana_server') == -1
- "host_running_haproxy == 'None'"
- name: Checking free port for Monasca Grafana API public HAProxy
wait_for:
host: "{{ kolla_external_vip_address }}"
port: "{{ monasca_grafana_server_port }}"
connect_timeout: 1
timeout: 1
state: stopped
when:
- haproxy_enable_external_vip | bool
- enable_monasca | bool
- inventory_hostname in groups['haproxy']
- haproxy_stat.find('monasca_grafana_server_external') == -1
- "host_running_haproxy == 'None'"
- name: Checking free port for Mongodb HAProxy
wait_for:
host: "{{ kolla_internal_vip_address }}"

View File

@ -600,6 +600,32 @@ listen grafana_server_external
{% endif %}
{% endif %}
{% if enable_monasca | bool %}
listen monasca_grafana_server
bind {{ kolla_internal_vip_address }}:{{ monasca_grafana_server_port }}
http-request del-header X-Forwarded-Proto
http-request set-header X-Forwarded-Proto https if { ssl_fc }
{% for http_option in haproxy_listen_http_extra %}
{{ http_option }}
{% endfor %}
{% for host in groups['monasca-grafana'] %}
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ monasca_grafana_server_port }} check inter 2000 rise 2 fall 5
{% endfor %}
{% if haproxy_enable_external_vip | bool %}
listen monasca_grafana_server_external
bind {{ kolla_external_vip_address }}:{{ monasca_grafana_server_port }} {{ tls_bind_info }}
http-request del-header X-Forwarded-Proto
http-request set-header X-Forwarded-Proto https if { ssl_fc }
{% for http_option in haproxy_listen_http_extra %}
{{ http_option }}
{% endfor %}
{% for host in groups['monasca-grafana'] %}
server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ monasca_grafana_server_port }} check inter 2000 rise 2 fall 5
{% endfor %}
{% endif %}
{% endif %}
{% if enable_ironic | bool %}
listen ironic_api
bind {{ kolla_internal_vip_address }}:{{ ironic_api_port }}

View File

@ -116,6 +116,17 @@ monasca_services:
- "/etc/localtime:/etc/localtime:ro"
- "kolla_logs:/var/log/kolla"
dimensions: "{{ monasca_agent_dimensions }}"
monasca-grafana:
container_name: monasca_grafana
group: monasca-grafana
enabled: true
image: "{{ monasca_grafana_image_full }}"
volumes:
- "{{ node_config_directory }}/monasca-grafana/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "monasca_grafana:/var/lib/grafana/"
- "kolla_logs:/var/log/kolla/"
dimensions: "{{ monasca_grafana_dimensions }}"
####################
# Databases
@ -123,6 +134,7 @@ monasca_services:
monasca_database_name: "monasca"
monasca_database_user: "{% if use_preconfigured_databases | bool and use_common_mariadb_user | bool %}{{ database_user }}{% else %}monasca{% endif %}"
monasca_database_address: "{{ database_address }}:{{ database_port }}"
monasca_grafana_database_name: "monasca_grafana"
monasca_influxdb_name: "monasca"
monasca_influxdb_address: "{{ kolla_internal_fqdn }}"
@ -170,6 +182,10 @@ monasca_agent_check_frequency: 30
monasca_log_pipeline_threads: 2
monasca_metric_pipeline_threads: 2
# Local password for Grafana. This account allows you to bypass Keystone
# authentication. This must *not* match any OpenStack username.
monasca_grafana_admin_username: "grafana_local_admin"
####################
# Docker
####################
@ -206,6 +222,10 @@ monasca_persister_image: "{{ docker_registry ~ '/' if docker_registry else '' }}
monasca_persister_tag: "{{ monasca_tag }}"
monasca_persister_image_full: "{{ monasca_persister_image }}:{{ monasca_persister_tag }}"
monasca_grafana_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ monasca_install_type }}-monasca-grafana"
monasca_grafana_tag: "{{ monasca_tag }}"
monasca_grafana_image_full: "{{ monasca_grafana_image }}:{{ monasca_grafana_tag }}"
monasca_agent_dimensions: "{{ default_container_dimensions }}"
monasca_api_dimensions: "{{ default_container_dimensions }}"
monasca_log_api_dimensions: "{{ default_container_dimensions }}"
@ -215,6 +235,7 @@ 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 }}"
monasca_grafana_dimensions: "{{ default_container_dimensions }}"
####################
# OpenStack

View File

@ -238,3 +238,25 @@
- config_json.changed | bool
or monasca_agent_statsd_confs.changed | bool
or monasca_agent_statsd_container.changed | bool
- name: Restart monasca-grafana container
vars:
service_name: "monasca-grafana"
service: "{{ monasca_services[service_name] }}"
config_json: "{{ monasca_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
monasca_grafana_container: "{{ check_monasca_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
become: true
kolla_docker:
action: "recreate_or_restart_container"
common_options: "{{ docker_common_options }}"
name: "{{ service.container_name }}"
image: "{{ service.image }}"
volumes: "{{ service.volumes }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or monasca_grafana_confs.changed | bool
or monasca_grafana_container.changed | bool

View File

@ -7,10 +7,13 @@
login_port: "{{ database_port }}"
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ monasca_database_name }}"
name: "{{ item }}"
register: database
run_once: True
delegate_to: "{{ groups['monasca-api'][0] }}"
with_items:
- "{{ monasca_database_name }}"
- "{{ monasca_grafana_database_name }}"
when:
- not use_preconfigured_databases | bool
@ -25,7 +28,7 @@
name: "{{ monasca_database_user }}"
password: "{{ monasca_database_password }}"
host: "%"
priv: "{{ monasca_database_name }}.*:ALL"
priv: "{{ monasca_database_name }}.*:ALL/{{ monasca_grafana_database_name }}.*:ALL"
append_privs: "yes"
run_once: True
delegate_to: "{{ groups['monasca-api'][0] }}"

View File

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

View File

@ -7,6 +7,7 @@
- include_tasks: config.yml
when: inventory_hostname in groups['monasca-agent'] or
inventory_hostname in groups['monasca-api'] or
inventory_hostname in groups['monasca-grafana'] or
inventory_hostname in groups['monasca-log-api'] or
inventory_hostname in groups['monasca-log-transformer'] or
inventory_hostname in groups['monasca-log-persister'] or
@ -16,7 +17,8 @@
inventory_hostname in groups['monasca-persister']
- include_tasks: bootstrap.yml
when: inventory_hostname in groups['monasca-api']
when: inventory_hostname in groups['monasca-api'] or
inventory_hostname in groups['monasca-grafana']
- name: Flush handlers
meta: flush_handlers
@ -24,6 +26,7 @@
- include_tasks: check.yml
when: inventory_hostname in groups['monasca-agent'] or
inventory_hostname in groups['monasca-api'] or
inventory_hostname in groups['monasca-grafana'] or
inventory_hostname in groups['monasca-log-api'] or
inventory_hostname in groups['monasca-log-transformer'] or
inventory_hostname in groups['monasca-log-persister'] or

View File

@ -47,3 +47,14 @@
when:
- inventory_hostname in groups[monasca_services['monasca-agent-statsd']['group']]
- container_facts['monasca_agent_statsd'] is not defined
- name: Checking free port for monasca-grafana server
wait_for:
host: "{{ api_interface_address }}"
port: "{{ monasca_grafana_server_port }}"
connect_timeout: 1
timeout: 1
state: stopped
when:
- inventory_hostname in groups[monasca_services['monasca-grafana']['group']]
- container_facts['monasca_grafana'] is not defined

View File

@ -0,0 +1,55 @@
[paths]
data = /var/lib/grafana
logs = /var/log/kolla/monasca
plugins = /var/lib/grafana/plugins
provisioning = /etc/grafana/provisioning
[users]
login_hint = OpenStack credentials
allow_org_create = false
allow_sign_up = false
[server]
protocol = http
http_addr = {{ api_interface_address }}
http_port = {{ monasca_grafana_server_port }}
router_logging = true
static_root_path = public
enable_gzip = false
[database]
type = mysql
host = {{ monasca_database_address }}
name = {{ monasca_grafana_database_name }}
user = {{ monasca_database_user }}
password = {{ monasca_database_password }}
ssl_mode = disable
[alerting]
enabled = false
execute_alerts = false
[session]
provider = mysql
provider_config = {{ monasca_database_user }}:{{ monasca_database_password }}@tcp({{ monasca_database_address }})/{{ monasca_grafana_database_name }}
cookie_name = monasca_grafana_sess
cookie_secure = false
session_life_time = 86400
[analytics]
reporting_enabled = false
check_for_updates = false
[security]
admin_user = {{ monasca_grafana_admin_username }}
admin_password = {{ monasca_grafana_admin_password }}
[auth.keystone]
enabled = true
auth_url = {{ keystone_internal_url }}
default_domain = {{ default_project_domain_name }}
default_role = Viewer
admin_roles = admin
editor_roles = _member_
verify_ssl_cert = false

View File

@ -0,0 +1,23 @@
{
"command": "/usr/sbin/grafana-server --config=/etc/grafana/grafana.ini",
"config_files": [
{
"source": "{{ container_config_directory }}/grafana.ini",
"dest": "/etc/grafana/grafana.ini",
"owner": "monasca",
"perm": "0600"
}
],
"permissions": [
{
"path": "/var/lib/grafana",
"owner": "monasca:monasca",
"recurse": true
},
{
"path": "/var/log/kolla/monasca",
"owner": "monasca:monasca",
"recurse": true
}
]
}

View File

@ -54,9 +54,6 @@ custom Kafka configuration:
echo "log.message.format.version=0.9.0.0" >> /etc/kolla/config/kafka.server.properties
Finally it should be noted that support for Kibana and Grafana integration has
not yet been enabled. This will be added in the future.
Building images
~~~~~~~~~~~~~~~

View File

@ -130,6 +130,7 @@ murano_agent_rabbitmq_password:
monasca_agent_password:
monasca_database_password:
monasca_grafana_admin_password:
monasca_keystone_password:
ironic_database_password:

View File

@ -0,0 +1,5 @@
---
features:
- |
Add support for deploying the Monasca fork of Grafana, which includes
Keystone integration.