Skip to main content

Data Sources

Base64 Image/Video/Audio/PDF Panel retrieves media data from the connected data source. You can use any suitable option to retrieve data in the Base64 format.

A static data source is the quickest way to get started. PostgreSQL is also an excellent choice.

Static data source

You can use a static data source to retrieve any supported Base64 formats and render them on your Grafana dashboard.

Limitation

The static data source is an option for storing and retrieving small and medium-sized files. If you get the 413 Request Entity Too Long error, it means that you have exceeded Grafana limits. You need to switch to the database or storage data source; PostgreSQL is an excellent choice for this.

PostgreSQL

For media files, the data source must return Base64 encoded file content and may return a format definition such as data:video/mp4;base64,ENCODED-CONTENT.

SELECT
concat(
'data:video/mp4;base64,',
encode(video, 'base64')
) as video
from
videos
where
name = 'flow';
Base64 Image/Video/Audio/PDF Panel displays media files on Grafana dashboard.
Base64 Image/Video/Audio/PDF Panel displays media files on Grafana dashboard.

The PostgreSQL database includes functions for working with the Base64 format.

SELECT CONVERT_FROM (DECODE('SGVsbG8gV29ybGQh', 'BASE64'), 'UTF-8');
SELECT ENCODE (CONVERT_TO('Hello World!', 'UTF-8'), 'BASE64');

Loading media files into the database

Create tables to store images, video, and audio files.

postgres/data.sql
loading...

Load PDF, PNG, MP4, MP3, and other supported file formats into your database using the Node.js script.

postgres/load.ts
loading...