vpalmisano / grafana-dynamictext-panel

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic text panel plugin for Grafana

Text

Grafana 8 CI codecov

Introduction

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.

Requirements

  • Grafana 7.0+ is required for version 1.X.

Getting Started

The Dynamic Text panel can be installed from the Grafana Catalog or use the grafana-cli tool to install from the command line:

grafana-cli plugins install marcusolsson-dynamictext-panel

Features

Panel Options

Content

A Handlebars template with support for Markdown.

To use display data from your query result, enter the name of the field surrounded by double braces. For example, to display the value from the Time field, enter {{Time}}.

Grafana renders the template for every row in the query result. If a query returns multiple query results, you can select the query result you wish to display from a drop-down menu.

You can even do basic text processing using one or more helpers inside your template.

Default content

Whenever the data source query returns an empty result, Grafana displays the template in Default content instead of Content.

This can be useful to provide users with instructions on what to do, or who to contact, when the query returns an empty result.

Even though there's no data from the data source, you can still use the available helpers.

Every row

By default, the template configured in the Content field is rendered for each record in the result.

You can render this template only once by turning this switch off. In this case, the query results are passed in as the data field to the template.

Handlebars provides a builtin-helper to iterate over these records.

Example

Let's say that your data source returns the following data:

| app  | description                  | cluster | tier     |
| ---- | ---------------------------- | ------- | -------- |
| auth | Handles user authentication. | prod    | frontend |

You can then write Markdown with placeholders for the data you want to use. The value inside each double brace expression refers to a field in the query result.

# {{app}}

{{description}}

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

The panel renders Handlebars → Markdown → HTML and displays the final result.

For more examples, take a look at

  • Helpers - functions that let you perform basic text transformation within your template.
  • Recipes - useful snippets that you can use in your templates.

Feedback

We love to hear from users, developers, and the whole community interested in this plugin. These are various ways to get in touch with us:

  • Ask a question, request a new feature, and file a bug with GitHub issues.
  • Star the repository to show your support.

License

  • Apache License Version 2.0, see LICENSE.

About

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

License:Apache License 2.0


Languages

Language:TypeScript 93.4%Language:JavaScript 6.6%