This is an example plugin for timelion that implements both a datasource
and a chainable
function. Both are well, useless, and serve entirely to demonstrate how to create a plugin for timelion.
.random()
is a datasource
function that produces random numbers between min
and max
. Like I said, pretty useless right?
.shuffle()
is a chainable
function that can be run to shuffle the points in a series, producing a series in which the points are the same as before, but appear in a random order
As this is an example, I don't publish package for it, but installing directly from Github is fairly simple:
- cd to your
kibana/plugins
orkibana/installedPlugins
directory. Only one of those will exist depending on your Kibana version. wget https://github.com/rashidkpc/timelion-random/archive/master.zip
unzip master.zip
rm kibana-random-master/gulpfile.js
(This is a dev environment thing. Kibana won't start if you don't removegulpfile.js
)- Start kibana (and delete that master.zip if you want, or not, it won't break anything)
If you've ever created a Kibana plugin before, this is going to be old hat. Otherwise:
- Setup a Kibana development environment and start it up. This isn't technically required, but will make your life easier. Otherwise you're going to have to bounce Kibana each time you make a change.
- Install timelion
- Clone this repo to a directory that is a sibling of your kibana directory. Eg
timelion-random/
andkibana/
should be on the same level of the directory tree mv timelion-random timelion-myplugin
cd timelion-myplugin
- Update
package.json
and changename
totimelion-myplugin
npm install
npm start
You can now start making changes. The plugin development environment will take care of syncing your changes. The main points of interest are:
functions/random.js
functions/shuffle.js
index.js
Note: If you make any changes toindex.js
you will need to bounce the kibana dev environment.
Depending on what kibana version you need a plugin for there are 2 branches in this repo, master
and 4.x
both have a gulp package
command that will package your plugin correctly and put it in the target/
directory.
If you're packaging a Kibana 5 plugin you will need to update the kibanas
array in package.json
to match the 5.x versions of Kibana you are targeting
git checkout 4.x
. The only real difference between the 2 branches is the gulpfile.js
that contains a different gulp package
task and the lack of a kibanas
array in package.json
Enjoy