Plugin Development for KIbana 5.6
Plugin Development for KIbana 5.6
Setup Development mode for Kibana
- git clone https://github.com/elastic/kibana.git
- cd kibana
- git checkout 5.6 (version of kibana you want to write plugin ,eg.5.6 is my kibana version)
- Make sure you have the same node version in kibana/.node-version dir
Steps to upgrade Node version
- sudo npm cache clean -f
- sudo npm install -g n
- sudo n 6.11.5
- Restart the machine to apply changes
Note: Just to improve a little bit more this answer, with "n" you can install any node version, so if you want the 8.6.0 version just type : "sudo n 8.6.0" instead "sudo n 6.11.5". Finally restart the machine, to apply changes
The Kibana configuration file is kibana.yml and it's located in the config directory. We need to edit this file:
$ cd /opt/kibana
$ vi config/kibana.yml
Kibana defaults to port 5601, but we want to set it explicitly. This port should not conflict with anything on the sandbox.
Uncomment this line:
#server.port: 5601
It should look like this:
server.port: 5601
We want to explicitly tell Kibana to listen to the host ip address:
Uncomment this line:
#server.host: "0.0.0.0"
Change it to this:
server.host: 0.0.0.0
We also want to explicitly set the Elasticsearch host.
Uncomment this line:
#elasticsearch.url: "http://localhost:9200"
Change it to this:
elasticsearch.url: "http://127.0.0.1:9200"
Save the file
Press Esc
!wq
Then,
- npm install
- sudo chown -R elastic:elastic /opt/kibana-4.6.1-linux-x86_64
- sudo su - elastic
- cd kibana
- Npm start
Note: Make sure you run the elasticsearch in your local instance
Sample Plugin Create:
Create a directory for your plugin that is right next to your Kibana directory.
The Kibana directory must be named kibana, and your plugin directory
must be a sibling directory
ls ~/wherever/you/store/your/code
kibana # <- where you store the Kibana development environment
my-new-plugin # <- your plugin directory
kibana # <- where you store the Kibana development environment
my-new-plugin # <- your plugin directory
Install SAO
npm install -g sao
Run the generator
cd my-new-plugin
sao kibana-plugin
sao kibana-plugin
HINT: If you need to use a version other than the latest, you can specify it when you run the template:
# SAO will install template-kibana-plugin@7.2.4
sao kibana-plugin@7.2.4
sao kibana-plugin@7.2.4
[Optional] Get the URL for your Elasticsearch installation
Elasticsearch is available at http://localhost:9200, unless you explicitly changed it in the Elasticsearch config.
Start Kibana in development mode with your new plugin included
npm start
HINT: If your Elasticsearch instance is running on another port, you can pass it in here.
npm start -- --elasticsearch.url 'http://localhost:9200'
# passing the elasticsearch.url here is to demonstrate how arguments can
# be passed to kibana with `npm start` but is not actually necessary if
# you are running elasticsearch locally
# passing the elasticsearch.url here is to demonstrate how arguments can
# be passed to kibana with `npm start` but is not actually necessary if
# you are running elasticsearch locally
Open your Kibana instance
Development Tasks
- npm start
- Start kibana and have it include this plugin
Comments
Post a Comment