Skip to content

Commit

Permalink
Add kibana custom dashboard
Browse files Browse the repository at this point in the history
These files provide an alternative for those who want their
custom dashboards on kibana. The playbook setupKibanaDashboards.yml
installs elasticdump and uses it to dump into kibana's index a simple
dashboard that collects logs from filebeat.

Change-Id: Ibb3407b1f19eac5f7cda753e00c3bc6f3ff16da7
  • Loading branch information
guilhermesteinmuller authored and cloudnull committed Jun 26, 2018
1 parent 1dba3bc commit fde2f64
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 1 deletion.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions elk_metrics_6x/readme.rst
Expand Up @@ -422,6 +422,24 @@ Example command using the embedded Ansible from within the grafana directory.
-e galera_root_user=root \
-e 'galera_address={{ internal_lb_vip_address }}'
Optional | add kibana custom dashboard
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you want to use a custom dashboard directly on your kibana,
you can run the playbook bellow. The dashboard uses filebeat to
collect the logs of your deployment.

.. code-block:: bash
ansible-playbook setupKibanaDashboard.yml $USER_VARS
Overview of kibana custom dashboard

.. image:: assets/openstack-kibana-custom-dashboard.png
:scale: 50 %
:alt: Kibana Custom Dashboard
:align: center


Upgrading the cluster
---------------------
Expand Down
37 changes: 37 additions & 0 deletions elk_metrics_6x/setupKibanaDashboard.yml
@@ -0,0 +1,37 @@
---
- name: Install Kibana Dashboards
hosts: "elastic-logstash"
become: true
vars_files:
- vars/variables.yml

environment: "{{ deployment_environment_variables | default({}) }}"

tasks:
- name: Add nodejs 6.x source
shell: "curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -"

- name: Install nodejs
apt:
name: nodejs
state: "present"
update_cache: yes
register: _apt_task
until: _apt_task is success
retries: 3
delay: 2

- name: Install elasticdump
npm:
name: elasticdump
path: /opt/elasticdump
state: "present"

- block:
- name: Copy openstack dashboard json template to /tmp dir
template:
src: templates/openstack-log-dashboard.json
dest: /tmp/openstack-log-dashboard.json

- name: Upload Custom Openstack Log Dashboard
shell: "/opt/elasticdump/node_modules/elasticdump/bin/elasticdump --input=/tmp/openstack-log-dashboard.json --output={{ kibana_index_on_elasticsearch }} --type=data"
107 changes: 107 additions & 0 deletions elk_metrics_6x/templates/openstack-log-dashboard.json
@@ -0,0 +1,107 @@
{
"_index":".kibana",
"_type":"doc",
"_id":"visualization:439b9700-78a4-11e8-b957-6d408ad5f3d7",
"_score":1,
"_source":{
"type":"visualization",
"visualization":{
"title":"[OpenStack] Log Level",
"visState":"{\"title\":\"[OpenStack] Log Level\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"isDonut\":true,\"labels\":{\"show\":false,\"values\":true,\"last_level\":true,\"truncate\":100}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{\"customLabel\":\"\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"loglevel\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"customLabel\":\"OpenStack LOG\"}}]}",
"uiStateJSON":"{}",
"description":"",
"version":1,
"kibanaSavedObjectMeta":{
"searchSourceJSON":"{\"index\":\"filebeat-*\",\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}"
}
}
}
}
{
"_index":".kibana",
"_type":"doc",
"_id":"visualization:aee19340-78b6-11e8-b957-6d408ad5f3d7",
"_score":1,
"_source":{
"type":"visualization",
"updated_at":"2018-06-25T20:31:04.820Z",
"visualization":{
"title":"[OpenStack] Log Level by Module Name",
"visState":"{\"title\":\"[OpenStack] Log Level by Module Name\",\"type\":\"pie\",\"params\":{\"addLegend\":true,\"addTooltip\":true,\"isDonut\":true,\"labels\":{\"last_level\":true,\"show\":false,\"truncate\":100,\"values\":true},\"legendPosition\":\"right\",\"type\":\"pie\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"module\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\"}}]}",
"uiStateJSON":"{}",
"description":"",
"version":1,
"kibanaSavedObjectMeta":{
"searchSourceJSON":"{\"index\":\"filebeat-*\",\"filter\":[],\"query\":{\"language\":\"lucene\",\"query\":\"\"}}"
}
}
}
}
{
"_index":".kibana",
"_type":"doc",
"_id":"visualization:7b6488c0-78b5-11e8-b957-6d408ad5f3d7",
"_score":1,
"_source":{
"type":"visualization",
"updated_at":"2018-06-25T20:22:28.939Z",
"visualization":{
"title":"[Openstack] Log Level Bar Per Host",
"visState":"{\"title\":\"[Openstack] Log Level Bar Per Host\",\"type\":\"histogram\",\"params\":{\"type\":\"histogram\",\"grid\":{\"categoryLines\":false,\"style\":{\"color\":\"#eee\"}},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"truncate\":100},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"Count\"}}],\"seriesParams\":[{\"show\":true,\"mode\":\"stacked\",\"type\":\"histogram\",\"drawLinesBetweenPoints\":true,\"showCircles\":true,\"data\":{\"id\":\"2\",\"label\":\"Count\"},\"valueAxis\":\"ValueAxis-1\"}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false},\"aggs\":[{\"id\":\"2\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"3\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"beat.hostname\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"size\":20,\"order\":\"desc\",\"orderBy\":\"2\"}},{\"id\":\"4\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"group\",\"params\":{\"field\":\"loglevel\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"2\"}}]}",
"uiStateJSON":"{}",
"description":"",
"version":1,
"kibanaSavedObjectMeta":{
"searchSourceJSON":"{\"index\":\"filebeat-*\",\"filter\":[],\"query\":{\"language\":\"lucene\",\"query\":\"\"}}"
}
}
}
}
{
"_index":".kibana",
"_type":"doc",
"_id":"search:51d3fb90-78b9-11e8-b957-6d408ad5f3d7",
"_score":1,
"_source":{
"type":"search",
"updated_at":"2018-06-25T20:51:10.156Z",
"search":{
"title":"AllLogs",
"description":"",
"hits":0,
"columns":[
"_source"
],
"sort":[
"@timestamp",
"desc"
],
"version":1,
"kibanaSavedObjectMeta":{
"searchSourceJSON":"{\"index\":\"filebeat-*\",\"highlightAll\":true,\"version\":true,\"query\":{\"language\":\"lucene\",\"query\":\"*\"},\"filter\":[]}"
}
}
}
}
{
"_index":".kibana",
"_type":"doc",
"_id":"dashboard:1ffbe820-78b0-11e8-b957-6d408ad5f3d7",
"_score":1,
"_source":{
"type":"dashboard",
"updated_at":"2018-06-25T20:52:44.699Z",
"dashboard":{
"title":"[Openstack] Log Dashboard",
"hits":0,
"description":"",
"panelsJSON":"[{\"panelIndex\":\"1\",\"gridData\":{\"x\":0,\"y\":0,\"w\":6,\"h\":3,\"i\":\"1\"},\"id\":\"439b9700-78a4-11e8-b957-6d408ad5f3d7\",\"type\":\"visualization\",\"version\":\"6.2.4\"},{\"panelIndex\":\"2\",\"gridData\":{\"x\":0,\"y\":3,\"w\":12,\"h\":5,\"i\":\"2\"},\"id\":\"7b6488c0-78b5-11e8-b957-6d408ad5f3d7\",\"type\":\"visualization\",\"version\":\"6.2.4\"},{\"panelIndex\":\"3\",\"gridData\":{\"x\":6,\"y\":0,\"w\":6,\"h\":3,\"i\":\"3\"},\"id\":\"aee19340-78b6-11e8-b957-6d408ad5f3d7\",\"type\":\"visualization\",\"version\":\"6.2.4\"},{\"panelIndex\":\"5\",\"gridData\":{\"x\":0,\"y\":8,\"w\":12,\"h\":5,\"i\":\"5\"},\"version\":\"6.2.4\",\"type\":\"search\",\"id\":\"51d3fb90-78b9-11e8-b957-6d408ad5f3d7\"}]",
"optionsJSON":"{\"darkTheme\":false,\"hidePanelTitles\":false,\"useMargins\":true}",
"version":1,
"timeRestore":false,
"kibanaSavedObjectMeta":{
"searchSourceJSON":"{\"query\":{\"language\":\"lucene\",\"query\":\"\"},\"filter\":[],\"highlightAll\":true,\"version\":true}"
}
}
}
}
2 changes: 1 addition & 1 deletion elk_metrics_6x/vars/variables.yml
Expand Up @@ -35,7 +35,7 @@ kibana_username: admin
kibana_password: admin
kibana_nginx_port: 81
kibana_server_name: "{{ ansible_hostname }}"

kibana_index_on_elasticsearch: "http://{{ hostvars[groups['elastic-logstash'][0]]['container_address'] }}:{{ elastic_port}}/.kibana"

# logstash vars
logstash_beat_input_port: 5044
Expand Down

0 comments on commit fde2f64

Please sign in to comment.