0

I want to embed one my specific chart in dahsboard of kibana. For that I need inject my JS into Kibana source. I have followed by instructions https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md to provide test environment, but I have obtained an error after "./kibana --dev"

let _ = require('lodash');
^^^

node.js:201
          throw e; // process.nextTick error, or 'error' event on first tick
          ^
SyntaxError: Unexpected strict mode reserved word
at Module._compile (module.js:429:25)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:41)

Can anybody help me with start environment, or advice. Probably, I am moving by wrong way...my general goal (inject my JS code into Kibana) can be reached by another approach.

Thanks

2 Answers2

0

I have reached my general goal, and if it is right - I place here my approach. (also, as an answer for above question)

When I was seeking ways how to implement what I want (my own custom metrics in dashboard....only as training and for personal "sport interest" sake) - I had chosen next way.

First of all - you need pay attention on index.js, not small one but huge file (more than 5MB), it predominantly contains angularJS terms.

My steps was:

  • I put into HTML empty container for my metrics <div class="metric_container"></div>.

HTML defines in index.js as

define('text!plugins/dashboard/index.html',[],function () { return '<div dashboard-app class="app-container dashboard-container">\n ..... you can try to search ctrl+F it over the index.js

  • I found variable with JSON data for charts (esResp)
  • I found watcher on changing it $scope.$watch('esResp', prereq(function (resp, pre Resp) {....
  • Put in the body of watcher my_function () call.
  • finished my_function() call, that contains completing HTML metric sample with renewed figures (from esResp JSON) and putting it into metric_container

so, I can develop my own metrics, charts, and it will be renew, but ONLY based on information provided in charts.

So, If you need smth - you need firstly create appropriate chart because of data set for you own calculations and further visualization.

Something So. I am sure, probably there is best way, but my was.

0

I have created a number of visualizations for Kibana 4.4.1, and once you have the right baseline, it is no big deal.

I encourage you to take a look at any of my sources, in order to know what has to be done (http://github.com/JuanCarniglia).

There are some basic files you need to have, and you have them, you just put them on the src/plugins directory, and restart kibana. If everything is fine, you get a new visualization on the list.

If you encounter any problems or need a more detailed description, send me a message or post it here and I'll try to explain with more detail.