MergenHub Envest
Home/Docs/Integrations

Grafana: step by step

A Grafana dashboard with the Infinity data source: access key (Bearer Token), Allowed hosts, the history address and ${__from} / ${__to}, column mapping, limits and common problems.

Logged history and live values from the Data Logger (historian) are plotted on Grafana dashboards without setting up a separate database. Grafana's Infinity data source reads MergenHub's JSON addresses with a read-only access key (Bearer Token). No user name or password is handed to Grafana.

Before you start

NeededWhy
The tags are logged in a log groupHistory is read from the Data Logger log groups.
An administrator with the Server settings permissionThey create the access key.
The key owner has the Data Logger read permissionThe key reads the tags its owner can see; it cannot exceed the owner's permissions.
The Grafana server can reach MergenHub over the networkWith HTTPS off the key works only from the local network.

1. Create an access key

  1. On the Settings › Data Bridge home page press Open on the Grafana card.
  2. Give the key a name (e.g. "Grafana production board"), pick how long it is valid; Create key.
  3. Copy the key right away: it is never shown again. It is filled into the example addresses and the test command on the page; the test command checks the connection before you move to Grafana.

2. Add the Infinity data source

  1. In Grafana install the Infinity data source plugin and add it as a new data source.
  2. Authentication = Bearer Token; paste the key.
  3. Allowed hosts = the MergenHub address (e.g. http://10.0.0.5:8090). Save.

3. Build the panel

  1. Pick Infinity as the panel's data source; Type = JSON, Source = URL.
  2. Address:
http://10.0.0.5:8090/config/v1/analytics/history?tags=TAG1,TAG2&from=${__from}&to=${__to}&maxPoints=${__maxDataPoints}
  1. Add the columns: time → Timestamp, value → Number, tag → String. Every tag becomes its own line.

${__from} and ${__to} are Grafana's own variables: when the dashboard's time range changes, so does the query. ${__maxDataPoints} limits the number of points to the panel width.

Addresses

AddressReturns
GET …/analytics/tagsTags with logged history and their groups. ?live=true: all live tags
GET …/analytics/current?tags=A,BLive value, quality, time (for a table or gauge panel)
GET …/analytics/history?tags=A,B&from=&to=&maxPoints=History in long format: each row is tag, time, value
  • Up to 50 tags per request; up to 10,000 points per tag (long ranges are thinned out).
  • Time: unix ms, unix seconds, ISO 8601 or relative (now, now-6h, now-7d). The last 24 hours if omitted.

Common problems

SymptomCause and fix
Empty resultThe tag is not logged in a log group or there is no data in the range. Query it on the Data Logger page to check.
403The key is used for another address or its owner lacks the permission. Report keys cannot read these addresses.
Grafana does not send the requestAllowed hosts in Infinity does not contain the MergenHub address.
Cannot connect from the internetHTTPS is off. Turn on HTTPS in Settings for outside access; see Publishing on a domain.

Related: Power BI and Excel · Historian (data logging) · Data Bridge · Manual: Grafana and Power BI