Dynamic text

Panel

A panel plugin for dynamic, data-driven text.
  • Dynamic text
    Dynamic text

Dynamic text for Grafana

License PRs welcome! Build Release

A panel plugin for Grafana for dynamic, data-driven text.

While the built-in Text panel in Grafana does support variables, that's about as dynamic it gets. This panel lets you define a text template using the data from your data source query.

The panel supports both Markdown and Handlebars.

Screenshot

Example

Here's an example of what you can do.

Data query response

appdescriptionclustertier
authHandles user authentication.prodfrontend

Content

# {{app}}

{{description}}

Deployed on {{join (variable "hostname") ", "}}.

{{#if (eq tier "frontend")}}
https://{{cluster}}.example.com/{{app}}
{{/if}}

Result

# auth

Handles user authentication.

Deployed on server1, server2, server3.

https://prod.example.com/auth

Helpers

Helpers are functions that let you perform basic text transformation within your template.

{{date}}

Formats the timestamp in a given field using a date format. Uses helper-date.

<!-- Time: 1598791377556 -->
{{date Time "YYYY-MM-DD"}}
<!-- results in: '2020-08-30'  -->

{{eq}}

Compares two strings for equality.

<!-- app: foo -->
{{#if (eq app "foo")}}
Success!
{{/if}}
<!-- results in: 'Success!'  -->

{{join}}

Join all elements of array into a string using a given separator.

<!-- array: ['a', 'b', 'c'] -->
{{join array "-"}}
<!-- results in: 'a-b-c'  -->

{{toFixed}}

Formats the given number using fixed-point notation.

<!-- Value: 1.1234 -->
{{toFixed Value 2}}
<!-- results in: '1.12' -->

{{variable}}

Returns a string array of the currently selected values for a certain variable.

{{variable "hostname"}}
<!-- results in: ['server1', 'server2', 'server3']  -->

Snippets

Check out these snippets for inspiration.

Markdown list from variable

{{#each (variable "hostname")}}
- {{.}}
{{/each}}

Conditional content

{{#if app "auth"}}
This is the auth app.
{{/if}}
Sign up Now

Version

Dependencies:
  • Grafana 7.x.x