@@ -126,3 +126,67 @@ To add *colours* for each dot, we need to combine the position with the value of
In which `HBAT_PWR_on_R` represents the power of an HBAT element, which we sum per tile over all elements using `sum by (host, x)`. The output of this, the first line, will determine the colour. The position is added by using `group_by`, which adds the critical `str_value` of the `HBAT_reference_geohash_R`. By using `+ on(...) (... * 0)`, we make sure the metric value is not influenced by the value of the geohash metric.
The colour is configured in the *Data Layer* by setting `Marker Color` to `Value`, and configuring the `Thresholds` at the bottom for the actual colour to be used for each range of values.
SVG Panels
------------------------------------
It is possible to display an SVG picture, and have areas of it highlight based on query results. We find the `ACE.SVG <https://grafana.com/grafana/plugins/aceiot-svg-panel/>`_ plugin to be useful.
An example setup can be constructed as follows:
* Add a query with the *Alerta UI* data source, with:
* Rename query to ``AlertaAlerts``,
* ``URL`` set to ``http://alerta-server:8080/api/alerts``,
* ``Rows/Root`` set to ``alerts``,
* Add ``Query Param``: key ``status`` value ``open`` (to filter out any closed alerts).
* Add a query with the *Grafana API* data source, with:
* Rename query to ``GrafanaAlerts``,
* ``URL`` set to ``http://localhost:3000/api/alertmanager/grafana/api/v2/alerts``,
* ``Rows/Root`` set to ``alerts``.
* Add a query with the *Prometheus* data source, with:
* Rename query to ``PrometheusData``,
* Query set to f.e. ``scrape_samples_scraped``.
* Load an SVG, with at least 2 named regions,
* Under ``SVG Mappings``, map these two regions to the names ``RegionA`` and ``RegionB``,
* Put the content of `lofar-svglib.js <https://git.astron.nl/lofar2.0/operations-central-management/-/tree/main/grafana-central/lofar-svglib.js>`_ in ``User JS Init Code``.
* Put the following code in ``User JS Render Code``::