forked from elastic/kibana
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Monitoring parity: make room for other products (elastic#28)
* Moves files under kibana folder to make room for other products * Creating top-level playbook
- Loading branch information
1 parent
5fdebe2
commit f58f1d8
Showing
3 changed files
with
166 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nitoring/scripts/python/kibana_compare.py → playbooks/monitoring/kibana/docs_compare.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
#---------------------------------------------------------------------------------------------------------------------- | ||
# Playbook: Test for parity between metricbeat-indexes and internally-indexed Monitoring docs | ||
# | ||
# Author: shaunak@elastic.co | ||
#---------------------------------------------------------------------------------------------------------------------- | ||
|
||
- name: Clean out old directories to hold monitoring sample docs files | ||
file: | ||
state: absent | ||
path: "{{ monitoring_docs_dir }}/kibana" | ||
delegate_to: localhost | ||
|
||
- name: Make directories to hold monitoring sample docs files | ||
file: | ||
state: directory | ||
path: "{{ monitoring_docs_dir }}/kibana/{{ item }}/" | ||
with_items: | ||
- internal | ||
- metricbeat | ||
delegate_to: localhost | ||
|
||
- name: Start elasticsearch with monitoring collection enabled | ||
include_role: | ||
name: xpack_elasticsearch | ||
vars: | ||
elasticsearch_config_params: {"xpack.monitoring.collection.enabled: true"} | ||
ait_role: xpack_elasticsearch_install_gencert_config_start_verify | ||
|
||
- name: Start kibana | ||
include_role: | ||
name: xpack_kibana | ||
vars: | ||
ait_role: xpack_kibana_install_config_start_verify | ||
|
||
- name: Wait for kibana to index a few monitoring documents | ||
wait_for: | ||
timeout: 15 | ||
|
||
- name: Stop kibana | ||
include_role: | ||
name: kibana | ||
vars: | ||
ait_role: kibana_shutdown_verify | ||
|
||
- name: Get sample kibana-indexed docs from monitoring index | ||
uri: | ||
method: POST | ||
url: "https://{{ current_host_ip }}:{{ elasticsearch_port }}/.monitoring-kibana-*/_search" | ||
validate_certs: no | ||
return_content: yes | ||
user: "{{ elasticsearch_username }}" | ||
password: "{{ elasticsearch_password }}" | ||
body: '{ "collapse": { "field": "type" }, "sort": { "timestamp": "desc" } }' | ||
body_format: json | ||
status_code: 200 | ||
register: xpack_elasticsearch_monitoring_sample_docs | ||
|
||
- name: Write sample docs to temp files | ||
copy: | ||
content: "{{ item._source }}" | ||
dest: "{{ monitoring_docs_dir }}/kibana/internal/{{ item._source.type }}.json" | ||
with_items: "{{ xpack_elasticsearch_monitoring_sample_docs.json.hits.hits }}" | ||
delegate_to: localhost | ||
|
||
- name: Stop kibana internal monitoring | ||
include_role: | ||
name: kibana | ||
vars: | ||
kibana_config_params: {"xpack.monitoring.kibana.collection.enabled: false"} | ||
ait_action: kibana_config | ||
|
||
- name: Clean out kibana monitoring index | ||
uri: | ||
method: DELETE | ||
url: "https://{{ current_host_ip }}:{{ elasticsearch_port }}/.monitoring-kibana-*" | ||
validate_certs: no | ||
user: "{{ elasticsearch_username }}" | ||
password: "{{ elasticsearch_password }}" | ||
status_code: 200 | ||
|
||
- name: Start kibana | ||
include_role: | ||
name: kibana | ||
vars: | ||
ait_role: kibana_startup_verify | ||
|
||
- name: Install metricbeat | ||
include_role: | ||
name: metricbeat | ||
vars: | ||
ait_action: metricbeat_install | ||
|
||
- name: Enable metricbeat's kibana module | ||
file: | ||
path: '{{ metricbeat_rootdir }}/modules.d/kibana.yml.disabled' | ||
state: absent | ||
become: true | ||
|
||
- name: Configure metricbeat's kibana module to collect monitoring documents | ||
copy: | ||
dest: '{{ metricbeat_rootdir }}/modules.d/kibana.yml' | ||
content: | | ||
- module: kibana | ||
metricsets: | ||
- stats | ||
period: 10s | ||
hosts: ["https://{{ current_host_ip }}:{{ kibana_port }}"] | ||
ssl.verification_mode: none | ||
username: "{{ elasticsearch_username }}" | ||
password: "{{ elasticsearch_password }}" | ||
xpack.enabled: true | ||
become: true | ||
|
||
- name: Start metricbeat | ||
include_role: | ||
name: xpack_metricbeat | ||
vars: | ||
ait_role: xpack_metricbeat_config_start_verify | ||
|
||
- name: Wait for metricbeat to index a few monitoring documents | ||
wait_for: | ||
timeout: 15 | ||
|
||
- name: Stop metricbeat | ||
include_role: | ||
name: metricbeat | ||
vars: | ||
ait_action: metricbeat_shutdown | ||
|
||
- name: Stop kibana | ||
include_role: | ||
name: kibana | ||
vars: | ||
ait_role: kibana_shutdown_verify | ||
|
||
- name: Get sample metricbeat-indexed docs from monitoring index | ||
uri: | ||
url: "https://{{ current_host_ip }}:{{ elasticsearch_port }}/.monitoring-kibana-*/_search" | ||
validate_certs: no | ||
return_content: yes | ||
user: "{{ elasticsearch_username }}" | ||
password: "{{ elasticsearch_password }}" | ||
method: POST | ||
body: '{ "collapse": { "field": "type" }, "sort": { "timestamp": "desc" } }' | ||
body_format: json | ||
status_code: 200 | ||
register: xpack_elasticsearch_monitoring_sample_docs | ||
|
||
- name: Write sample docs to temp files | ||
copy: | ||
content: "{{ item._source }}" | ||
dest: "{{ monitoring_docs_dir }}/kibana/metricbeat/{{ item._source.type }}.json" | ||
with_items: "{{ xpack_elasticsearch_monitoring_sample_docs.json.hits.hits }}" | ||
delegate_to: localhost | ||
|
||
- name: Stop elasticsearch | ||
include_role: | ||
name: elasticsearch | ||
vars: | ||
ait_action: elasticsearch_shutdown | ||
|
||
- name: Compare internally-indexed and metricbeat-indexed documents for parity | ||
shell: 'python {{ playbook_dir }}/kibana/docs_compare.py {{ monitoring_docs_dir }}/kibana/internal {{ monitoring_docs_dir }}/kibana/metricbeat' | ||
delegate_to: localhost |