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

Rewrite import_dashboards.sh script in go #2155

Merged
merged 4 commits into from
Aug 17, 2016

Conversation

monicasarbu
Copy link
Contributor

@monicasarbu monicasarbu commented Aug 2, 2016

This PR includes a rewrite of the import_dashboards.sh script in Golang.

Features:

  • change the index name by using the -i option
  • authenticate the connection to Elasticsearch using username:password
  • update test to test import dashboards

We need to include this script into the Beat package (in a separate PR).

The import accepts the following options:

Usage: ./import [options]

Kibana dashboards are stored in a special index in Elasticsearch together with the searches,",visualizations and indexes that they use.")

You can import the dashboards, visualizations, searches and index-pattern for any Beat:
  1. from a local directory:
    ./import -dir etc/kibana
  2. from a directory of a local zip archive:
    ./import -dir metricbeat -file beats-dashboards-1.2.3.zip
  3. from a directory of zip archive available online:
    ./import -dir metricbeat -url http://download.elastic.co/beats/dashboards/beats-dashboards-1.2.3.zip

Options:
  -dir string
        Directory containing the subdirectories: dashboard, visualization, search, index-pattern. eg. kibana/
  -es string
        Elasticsearch URL (default "http://127.0.0.1:9200")
  -file string
        Zip archive file containing the Beats dashboards.
  -i string
        Overwrites the Elasticsearch index name. For example you can replaces metricbeat-* with custombeat-*
  -k string
        Kibana index (default ".kibana")
  -pass string
        Password to connect to Elasticsearch
  -url string
        URL to the zip archive containing the Beats dashboards
  -user string
        Username to connect to Elasticsearch

@monicasarbu monicasarbu added the in progress Pull request is currently in progress. label Aug 2, 2016
@@ -44,7 +44,11 @@ https://github.com/elastic/beats/compare/v5.0.0-alpha5...master[Check the HEAD d
==== Added

*Affecting all Beats*

- Add enabled setting to packetbeat protocols. {pull}1988[1988]
Copy link
Contributor Author

@monicasarbu monicasarbu Aug 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added them manually here after they were removed in a previous PR. They are not part of alpha5 release.

@monicasarbu monicasarbu force-pushed the rewrite_import_in_go branch 2 times, most recently from 2c6069d to abcb0e3 Compare August 11, 2016 14:22
@monicasarbu monicasarbu removed the in progress Pull request is currently in progress. label Aug 15, 2016
@monicasarbu monicasarbu force-pushed the rewrite_import_in_go branch 2 times, most recently from 64eb1ee to 496f352 Compare August 16, 2016 07:16
@monicasarbu monicasarbu added the in progress Pull request is currently in progress. label Aug 16, 2016
@monicasarbu monicasarbu removed the in progress Pull request is currently in progress. label Aug 16, 2016
@monicasarbu monicasarbu force-pushed the rewrite_import_in_go branch 3 times, most recently from dab70dc to 888562e Compare August 17, 2016 09:24
The format of each field can be specified in fields.yml using the `format` option.

Generate Kibana index pattern for all the elastic beats by running `make update`
…and unix systems instead of two scripts (bash

+powershell).

The script imports the dashboards together with visualizations, searches and index pattern for a Beat in Elasticsearch.
The script is added to the Beat package.
@@ -8,6 +8,7 @@ _output
/docs/html_docs
.vagrant
build
/dashboards/import_dashboards
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will this ignore exactly? In case these are the generated dashboards, shouldn't these be in the build directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import_dashboards is the exec, built from import_dashboards.go. This is generated with make build-dashboards.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. I got confused as the entry is under the list of excluded directories.


cl.flagSet.Usage = func() {
const usage = `
Usage: ./import_dashboards [options]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment below about import vs load. Should we call it load_dashboards?

@ruflin
Copy link
Member

ruflin commented Aug 17, 2016

It's really great to have this script as it makes it cross platform compatible without having additional dependencies. I left a few comments in the code.

@monicasarbu
Copy link
Contributor Author

@ruflin I addressed all your comments, thank you!

@monicasarbu monicasarbu mentioned this pull request Aug 17, 2016
6 tasks
@tsg
Copy link
Contributor

tsg commented Aug 17, 2016

Merging so we can continue with packaging.

@tsg tsg merged commit 5a5c5a5 into elastic:master Aug 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants