Grafana panel for displaying metric sensitive or arbitary HTML.
This only works with Grafana 3.X or later
The control allows the specification of CSS, HTML and JS for both initialisation and metric updates.
This is based on the work by Marcus Calidus and the SVG plugin.
It is possible to clone this repo directly into your plugins directory. (var/lib/grafana/plugins)
Afterwards restart grafana-server and the plugin should be automatically detected and used.
npm install
grunt
sudo service grafana-server restart
If the plugin is cloned to a directory that is not the default plugins directory then you need to edit your grafana.ini config file (Default location is at /etc/grafana/grafana.ini) and add this:
[plugin.svg]
path = /home/your/clone/dir/svg-panel
Note that if you clone it into the grafana plugins directory you do not need to add the above config option. That is only if you want to place the plugin in a directory outside the standard plugins directory. Be aware that grafana-server needs read access to the directory.
HTML & CSS is encapsulated in a shadow root and will therefore not "leak" outside the control.
this code is execute upon every Rerfresh
onHandleMetric(ctrl: MetricsPanelCtrl, svgnode: HTMLElement)
ctrl
passes a grafana MetricsPanelCtrl
object. This object contains all relevant data pertainig the current panel.
You may want to use the ctrl.data
array property to access the current measurement data.
htmlnode
passes the HTMLElement of the html content on the panel. THis allows direct access to and editing of the html
content
htmlnode.innerHTML = "Hello World";
this event is executed once, right after the first initializiation of the SVG.
onHandleMetric(ctrl: MetricsPanelCtrl, svgnode: HTMLElement)
ctrl
passes a grafana MetricsPanelCtrl
object. This object contains all relevant data pertainig the current panel.
You may want to use the ctrl.data
array property to access the current measurement data.
htmlnode
passes the HTMLElement of the html content on the panel. THis allows direct access to and editing of the html
htmlnode.innerHTML = "Hello World";
SVG Grafana plugin on which this HTML plugin is based
Icons used in this plugin