Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract Kibana dashboards #7224

Merged
merged 3 commits into from
Jun 4, 2018
Merged

Conversation

ruflin
Copy link
Member

@ruflin ruflin commented May 31, 2018

Currently when a PR is opened to change or add a dashboard the PR's are hard to review even if only a small detail was changed. The reasons is that the Kibana json objects contain json as string. The content inside these strings is valid JSON if it is decoded.

With this PR the dashboards in Metricbeat are modified that they contain the full decoded JSON objects instead of the string. Additional the JSON entries are sorted. This makes also the content of the visualisations readable, will create minimal diffs and allows to even apply small fixes on the code base. In addition we can now validate if it's valid JSON and introduce automatic scripts to remove potentially unneeded fields from the dashboards to clean them up.

All the existing dashboards were decoded with the following command:

python ../libbeat/scripts/unpack_dashboards.py --transform=decode --glob="/Users/ruflin/Dev/gopath/src/github.com/elastic/beats/metricbeat/module/*/_meta/kibana/6/dashboard/*.json"

This command has to be applied to dashboards exported from Kibana before adding them to the module directory.

To make sure the import still works as before, on collection of the dashboard they are converted back into the encoded format.

This change currently only applies to Metricbeat dashboards but could be applied to all.

Currently when a PR is opened to change or add a dashboard the PR's are hard to review even if only a small detail was changed. The reasons is that the Kibana json objects contain json as string. The content inside these strings is valid JSON if it is decoded.

With this PR the dashboards in Metricbeat are modified that they contain the full decoded JSON objects instead of the string. Additional the JSON entries are sorted. This makes also the content of the visualisations readable, will create minimal diffs and allows to even apply small fixes on the code base. In addition we can now validate if it's valid JSON and introduce automatic scripts to remove potentially unneeded fields from the dashboards to clean them up.

All the existing dashboards were decoded with the following command:
```
python ../libbeat/scripts/unpack_dashboards.py --transform=decode --glob="/Users/ruflin/Dev/gopath/src/github.com/elastic/beats/metricbeat/module/*/_meta/kibana/6/dashboard/*.json"
```

This command has to be applied to dashboards exported from Kibana before adding them to the module directory.

To make sure the import still works as before, on collection of the dashboard they are converted back into the encoded format.

This change currently only applies to Metricbeat dashboards but could be applied to all.
@ruflin ruflin added discuss Issue needs further discussion. Metricbeat Metricbeat :Dashboards labels May 31, 2018
@ruflin
Copy link
Member Author

ruflin commented Jun 1, 2018

Here is a follow up PR to also adjust the exporter script: #7241

@ruflin ruflin added review and removed discuss Issue needs further discussion. labels Jun 1, 2018
@ruflin ruflin changed the title [Discuss] Extract Kibana dashboards Extract Kibana dashboards Jun 1, 2018
@jsoriano jsoriano merged commit 2e1b7c8 into elastic:master Jun 4, 2018
@ruflin ruflin deleted the kibana-dashboards-decoding branch June 4, 2018 07:51
ruflin added a commit to ruflin/beats that referenced this pull request Jun 4, 2018
In elastic#7239 support to export a dashboard is a added to each Beat. This is expected to be used by users. The export_dashboard script from the Beats repository is expected by the Devs and contributors which want to add new dashboards.

In elastic#7224 the dashboards are modified to be stored with decoded json objects for better versioning. This change modifies the export dashboard script so it generates the same decoded output so no additional conversion is needed.

Note: The export_dashboard script could need some cleanup but I didn't tackle this in this PR and leave it for later to keep the change to a minimum.
jsoriano pushed a commit that referenced this pull request Jun 4, 2018
In #7239 support to export a dashboard is a added to each Beat. This is expected to be used by users. The export_dashboard script from the Beats repository is expected by the Devs and contributors which want to add new dashboards.

In #7224 the dashboards are modified to be stored with decoded json objects for better versioning. This change modifies the export dashboard script so it generates the same decoded output so no additional conversion is needed.
ruflin added a commit to ruflin/beats that referenced this pull request Jun 5, 2018
ruflin added a commit to ruflin/beats that referenced this pull request Jun 5, 2018
ruflin added a commit to ruflin/beats that referenced this pull request Jun 5, 2018
Apply decoding of dashboards also to Heartbeat. See elastic#7224 for more details.
jsoriano pushed a commit that referenced this pull request Jun 5, 2018
Apply decoding of dashboards also to Heartbeat.
See #7224 for more details.
jsoriano pushed a commit that referenced this pull request Jun 5, 2018
jsoriano pushed a commit that referenced this pull request Jun 5, 2018
ruflin added a commit to ruflin/beats that referenced this pull request Jun 8, 2018
Currently all dashboards end up under `_meta/kibana` in each Beat. The problem with this directory is that for some Beats it contains the automatically collected and generated files and for others the original. This prevents us from having decoded JSON files for all dashboards across Beats.

An other benefit of having the `kibana.generated` directory is that now `_meta/kibana` can become the place for dashboards across modules in one Beat without having to worry about overwriting / removing these dashboards.

Community Beats must convert their dashboards with the script under elastic#7224.

Further changes:

* Decode Packetbeat and Winlogbeat dashboards
* Move encoding step to libbeat so it is applied automatically to all dashboards in the kibana.generated directory.
* Remove _meta/kibana from .gitignore as it can now be used to contain dashboards in all Beats.
* Adjust Makefiles for the new logic.
* Adjust tests to depend on kibana.generated directory
jsoriano pushed a commit that referenced this pull request Jun 11, 2018
Currently all dashboards end up under `_meta/kibana` in each Beat. The problem with this directory is that for some Beats it contains the automatically collected and generated files and for others the original. This prevents us from having decoded JSON files for all dashboards across Beats.

An other benefit of having the `kibana.generated` directory is that now `_meta/kibana` can become the place for dashboards across modules in one Beat without having to worry about overwriting / removing these dashboards.

Community Beats must convert their dashboards with the script under #7224.

Further changes:

* Decode Packetbeat and Winlogbeat dashboards
* Move encoding step to libbeat so it is applied automatically to all dashboards in the kibana.generated directory.
* Remove _meta/kibana from .gitignore as it can now be used to contain dashboards in all Beats.
* Adjust Makefiles for the new logic.
* Adjust tests to depend on kibana.generated directory
webmat pushed a commit to webmat/beats that referenced this pull request Aug 27, 2018
adriansr pushed a commit to adriansr/beats that referenced this pull request Sep 26, 2018
adriansr pushed a commit to adriansr/beats that referenced this pull request Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants