Support configuring Grafana

This add supports for running the stackhpc.grafana-conf Ansible
Galaxy role against a monitoring server to configure Grafana
post deployment. This includes:

* Creating an organisation
* Configuring dashboards for the organisation from a git repo
* Configuring datasources for the organisation
This commit is contained in:
Doug Szumski 2018-01-17 16:52:12 +00:00
parent 1764dd8393
commit 0cd6d17d0c
6 changed files with 142 additions and 1 deletions

View File

@ -0,0 +1,50 @@
---
###############################################################################
# Grafana configuration.
# Grafana local admin user name. If you are deploying Monasca Grafana this
# should not conflict with an OpenStack user name.
#grafana_local_admin_user_name:
grafana_local_admin_user_name: "grafana_admin"
# Path to git repo containing Grafana dashboards. Eg.
# https://github.com/stackhpc/grafana-reference-dashboards.git
#grafana_monitoring_node_dashboard_repo:
grafana_monitoring_node_dashboard_repo:
# Path to which Grafana dashboards will be cloned to a monitoring node
#grafana_monitoring_node_dashboard_repo_path:
grafana_monitoring_node_dashboard_repo_path: "/var/opt/grafana/"
# The Grafana organisation for the control plane. Note that for Monasca
# Grafana with domain support the format is:
# organisation_name@openstack_domain
#grafana_control_plane_organisation:
grafana_control_plane_organisation: "control_plane"
# A list of datasources to configure. See the stackhpc.grafana-conf role
# for a list of supported datasources. Example:
#
# grafana_datasources:
# monasca_api:
# port: 8082
# host: monasca-api
# monasca_log_api:
# port: 5607
# host: monasca-log-api
# elasticsearch:
# port: 9200
# host: monasca-elasticsearch
# project_id: "some_id"
#
#grafana_datasources:
grafana_datasources:
# The path, relative to the grafana_monitoring_node_dashboard_repo_path
# containing the dashboards. Eg. /prometheus/control_plane
#grafana_monitoring_node_dashboard_path:
grafana_monitoring_node_dashboard_path:
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes

View File

@ -0,0 +1,44 @@
---
- name: Check whether Grafana is enabled
hosts: overcloud
tags:
- grafana
tasks:
- name: Create monitoring group with grafana enabled
group_by:
key: "monitoring_with_grafana_enabled_{{ kolla_enable_grafana | bool }}"
- name: Configure control plane monitoring for Grafana
# Only required to run on a single host.
hosts: monitoring_with_grafana_enabled_True[0]
gather_facts: False
tags:
- grafana
pre_tasks:
- name: Set fact for the VIP address
set_fact:
kolla_internal_vip_address: "{{ internal_net_name | net_vip_address }}"
when: kolla_enable_haproxy | bool
- name: Set fact for the VIP address
set_fact:
kolla_internal_vip_address: "{{ internal_net_name | net_ip(network_host) }}"
when: not kolla_enable_haproxy | bool
- name: Clone dashboards
git:
repo: "{{ grafana_monitoring_node_dashboard_repo }}"
dest: "{{ grafana_monitoring_node_dashboard_repo_path }}"
when: grafana_monitoring_node_dashboard_repo | bool
become: True
- name: Include Kolla passwords for Grafana local admin account credentials
include_vars: "{{ kayobe_config_path }}/kolla/passwords.yml"
roles:
- role: stackhpc.grafana-conf
grafana_conf_organisation: "{{ grafana_control_plane_organisation }}"
grafana_conf_grafana_admin_user: "{{ grafana_local_admin_user_name }}"
grafana_conf_grafana_admin_pass: "{{ grafana_admin_password }}"
grafana_conf_grafana_url: "http://{{ kolla_internal_vip_address }}:3000"
grafana_conf_grafana_datasources: "{{ grafana_datasources }}"
grafana_conf_grafana_dashboards: "{{ grafana_monitoring_node_dashboard_repo_path }}{{ grafana_monitoring_node_dashboard_path }}"

View File

@ -379,3 +379,4 @@ This will perform the following tasks:
- Register Ironic Python Agent (IPA) images with glance
- Register introspection rules with ironic inspector
- Register a provisioning network and subnet with neutron
- Configure Grafana organisations, dashboards and datasources

44
etc/kayobe/grafana.yml Normal file
View File

@ -0,0 +1,44 @@
---
###############################################################################
# Grafana configuration.
# Grafana local admin user name. If you are deploying Monasca Grafana this
# should not conflict with an OpenStack user name.
#grafana_local_admin_user_name:
# Path to git repo containing Grafana dashboards. Eg.
# https://github.com/stackhpc/grafana-reference-dashboards.git
#grafana_monitoring_node_dashboard_repo:
# Path to which Grafana dashboards will be cloned to a monitoring node
#grafana_monitoring_node_dashboard_repo_path:
# The Grafana organisation for the control plane. Note that for Monasca
# Grafana with domain support the format is:
# organisation_name@openstack_domain
#grafana_control_plane_organisation:
# A list of datasources to configure. See the stackhpc.grafana-conf role
# for a list of supported datasources. Example:
#
# grafana_datasources:
# monasca_api:
# port: 8082
# host: monasca-api
# monasca_log_api:
# port: 5607
# host: monasca-log-api
# elasticsearch:
# port: 9200
# host: monasca-elasticsearch
# project_id: "some_id"
#
#grafana_datasources:
# The path, relative to the grafana_monitoring_node_dashboard_repo_path
# containing the dashboards. Eg. /prometheus/control_plane
#grafana_monitoring_node_dashboard_path:
###############################################################################
# Dummy variable to allow Ansible to accept this file.
workaround_ansible_issue_8743: yes

View File

@ -1087,6 +1087,7 @@ class OvercloudPostConfigure(KayobeAnsibleMixin, VaultMixin, Command):
* Register ironic inspector introspection rules with the overcloud
inspector service.
* Register a provisioning network with glance.
* Configure Grafana for control plane.
"""
def take_action(self, parsed_args):
@ -1094,7 +1095,7 @@ class OvercloudPostConfigure(KayobeAnsibleMixin, VaultMixin, Command):
playbooks = _build_playbook_list(
"overcloud-ipa-images", "overcloud-introspection-rules",
"overcloud-introspection-rules-dell-lldp-workaround",
"provision-net")
"provision-net", "overcloud-grafana-configure")
self.run_kayobe_playbooks(parsed_args, playbooks)

View File

@ -10,6 +10,7 @@
name: singleplatform-eng.users
- src: stackhpc.drac
- src: stackhpc.drac-facts
- src: stackhpc.grafana-conf
- src: stackhpc.libvirt-host
- src: stackhpc.libvirt-vm
- src: stackhpc.os-flavors