openstack-ansible-ops/elk_metrics_6x
Jonathan Rosser ebf309a9e7 Use environment: to manipulate PATH and GOPATH env vars
Change-Id: I71567994b4e479d118a0f402b2120da23b4fbd4d
2018-05-16 17:57:20 +01:00
..
conf.d Add APM Server 2018-04-16 08:36:48 -05:00
env.d Add APM Server 2018-04-16 08:36:48 -05:00
templates Merge "update heartbeat vars to check response" 2018-05-12 19:55:34 +00:00
vars Convert ELK repo location to a variable so it can be overridden 2018-05-16 12:34:01 +01:00
ansible-role-requirements.yml Clean up docs and bootstrap script 2018-05-10 23:30:46 +00:00
bootstrap-embedded-ansible.sh Use Ansible 2.5 compatible version of connection plugin 2018-05-15 21:33:03 +01:00
common_task_install_elk_repo.yml Convert ELK repo location to a variable so it can be overridden 2018-05-16 12:34:01 +01:00
common_task_install_go1.10.1.yml Add journalbeat 2018-04-29 00:45:34 -05:00
installAPMserver.yml Allow deploy time env vars when deploying ELK stack 2018-05-16 12:34:04 +01:00
installAuditbeat.yml Allow deploy time env vars when deploying ELK stack 2018-05-16 12:34:04 +01:00
installCurator.yml Allow deploy time env vars when deploying ELK stack 2018-05-16 12:34:04 +01:00
installElastic.yml Allow deploy time env vars when deploying ELK stack 2018-05-16 12:34:04 +01:00
installFilebeat.yml Allow deploy time env vars when deploying ELK stack 2018-05-16 12:34:04 +01:00
installHeartbeat.yml Allow deploy time env vars when deploying ELK stack 2018-05-16 12:34:04 +01:00
installJournalbeat.yml Use environment: to manipulate PATH and GOPATH env vars 2018-05-16 17:57:20 +01:00
installKibana.yml Allow deploy time env vars when deploying ELK stack 2018-05-16 12:34:04 +01:00
installLogstash.yml Allow deploy time env vars when deploying ELK stack 2018-05-16 12:34:04 +01:00
installMetricbeat.yml Allow deploy time env vars when deploying ELK stack 2018-05-16 12:34:04 +01:00
installPacketbeat.yml Allow deploy time env vars when deploying ELK stack 2018-05-16 12:34:04 +01:00
inventory.example.yml Update docs and add inventory example 2018-04-13 10:24:15 -05:00
readme.rst Add cleanup process when using embedded ansible 2018-05-14 13:03:09 -05:00
site.yml Add journalbeat 2018-04-29 00:45:34 -05:00

Install ELK with beats to gather metrics

tags

openstack, ansible

About this repository

This set of playbooks will deploy elk cluster (Elasticsearch, Logstash, Kibana) with topbeat to gather metrics from hosts metrics to the ELK cluster.

These playbooks require Ansible 2.5+.

OpenStack-Ansible Integration

These playbooks can be used as standalone inventory or as an integrated part of an OpenStack-Ansible deployment. For a simple example of standalone inventory, see inventory.example.yml.

Optional | Load balancer VIP address

In order to use multi-node elasticsearch a loadbalancer is required. Haproxy can provide the load balancer functionality needed. The option internal_lb_vip_address is used as the endpoint (virtual IP address) services like Kibana will use when connecting to elasticsearch. If this option is omitted, the first node in the elasticsearch cluster will be used.

Optional | configure haproxy endpoints

Edit the /etc/openstack_deploy/user_variables.yml file and add the following lines.

haproxy_extra_services:
 - service:
      haproxy_service_name: kibana
      haproxy_ssl: False
      haproxy_backend_nodes: "{{ groups['kibana'] | default([]) }}"
      haproxy_port: 81  # This is set using the "kibana_nginx_port" variable
      haproxy_balance_type: tcp
  - service:
      haproxy_service_name: elastic-logstash
      haproxy_ssl: False
      haproxy_backend_nodes: "{{ groups['elastic-logstash'] | default([]) }}"
      haproxy_port: 5044  # This is set using the "logstash_beat_input_port" variable
      haproxy_balance_type: tcp
  - service:
      haproxy_service_name: elastic-logstash
      haproxy_ssl: False
      haproxy_backend_nodes: "{{ groups['elastic-logstash'] | default([]) }}"
      haproxy_port: 9201  # This is set using the "elastic_hap_port" variable
      haproxy_check_port: 9200  # This is set using the "elastic_port" variable
      haproxy_backend_port: 9200  # This is set using the "elastic_port" variable
      haproxy_balance_type: tcp

Optional | run the haproxy-install playbook

cd /opt/openstack-ansible/playbooks/
openstack-ansible haproxy-install.yml --tags=haproxy-service-config

Setup | system configuration

Clone the elk-osa repo

cd /opt
git clone https://github.com/openstack/openstack-ansible-ops

Copy the env.d file into place

cd /opt/openstack-ansible-ops/elk_metrics_6x
cp env.d/elk.yml /etc/openstack_deploy/env.d/

Copy the conf.d file into place

cp conf.d/elk.yml /etc/openstack_deploy/conf.d/

In elk.yml, list your logging hosts under elastic-logstash_hosts to create the elasticsearch cluster in multiple containers and one logging host under kibana_hosts to create the kibana container

vi /etc/openstack_deploy/conf.d/elk.yml

Create the containers

cd /opt/openstack-ansible/playbooks
openstack-ansible lxc-containers-create.yml -e 'container_group=elastic-logstash:kibana:apm-server'

Deploying | Installing with embedded Ansible

If this is being executed on a system that already has Ansible installed but is incompatible with these playbooks the script bootstrap-embedded-ansible.sh can be sourced to grab an embedded version of Ansible prior to executing the playbooks.

source bootstrap-embedded-ansible.sh

Deploying | Manually resolving the dependencies

This playbook has external role dependencies. If Ansible is not installed with the bootstrap-ansible.sh script these dependencies can be resolved with the ansible-galaxy command and the ansible-role-requirements.yml file.

  • Example galaxy execution
ansible-galaxy install -r ansible-role-requirements.yml

Once the dependencies are set make sure to set the action plugin path to the location of the config_template action directory. This can be done using the environment variable ANSIBLE_ACTION_PLUGINS or through the use of an ansible.cfg file.

Deploying | The environment

Install master/data elasticsearch nodes on the elastic-logstash containers, deploy logstash, deploy kibana, and then deploy all of the service beats.

cd /opt/openstack-ansible-ops/elk_metrics_6x
ansible-playbook site.yml $USER_VARS
  • The openstack-ansible command can be used if the version of ansible on the system is greater than 2.5.

The individual playbooks found within this repository can be independently run at anytime.

Optional | add Grafana visualizations

See the grafana directory for more information on how to deploy grafana. Once When deploying grafana, source the variable file from ELK in order to automatically connect grafana to the Elasticsearch datastore and import dashboards. Including the variable file is as simple as adding -e @../elk_metrics_6x/vars/variables.yml to the grafana playbook run.

Included dashboards.

Example command using the embedded Ansible from within the grafana directory.

ansible-playbook ${USER_VARS} installGrafana.yml \
                              -e @../elk_metrics_6x/vars/variables.yml \
                              -e galera_root_user=root \
                              -e 'galera_address={{ internal_lb_vip_address }}'

Trouble shooting

If everything goes bad, you can clean up with the following command

openstack-ansible /opt/openstack-ansible-ops/elk_metrics_6x/site.yml -e "elk_package_state=absent" --tags package_install
openstack-ansible /opt/openstack-ansible/playbooks/lxc-containers-destroy.yml --limit=kibana:elastic-logstash_all