paveldanilin / grafana-csv-plugin

CSV datasource for Grafana 6.x.x / 7.x.x
MIT License
36 stars 12 forks source link
csv csv-datasource datasource golang grafana plugin sftp sql sqlite

CSV datasource for Grafana 6.x.x

Many thanks to JetBrains for providing the OS license for an amazing GoLand IDE.

JetBrains logo

Install

Grafana 7.x.x

The plugin is unsigned, hence you may face the error:

lvl=eror msg=“Failed to load plugin” logger=plugins error=“plugin “grafana-csv-plugin” is unsigned”

To get it to work you should make configuration as described in documentation

Features

CSV format

Query

Macros

Macros Description
$__timeFilter(dateColumn) Will be replaced by a time range filter using the specified column name. For example, dateColumn BETWEEN ‘2017-04-21T05:01:17Z’ AND ‘2017-04-21T05:06:17Z’
$timeGroup(dateColumn, interval), Examples: `sec: $timeGroup(dateColumn, 60); min: $timeGroup(dateColumn, 60m); hour: $timeGroup(dateColumn, 1h)` Will be replaced by an expression usable in a GROUP BY clause. For example, datetime((strftime('%s', dateColumn) / 60) * 60, 'unixepoch')
$__unixEpochFrom() Will be replaced by the start of the currently active time selection as Unix timestamp. For example, 1494410783
$__unixEpochTo() Will be replaced by the end of the currently active time selection as Unix timestamp. For example, 1494497183

Build graphs

Example:

SELECT $__timeGroup(cdatetime, 1h) as "time", district as "metric", count(*) as "value"
FROM
    jan_2006
WHERE
    $__timeFilter(cdatetime)
GROUP BY "time", "metric"
ORDER BY "time"

Example:

SELECT $__timeGroup(Transaction_date, 24h) as "time", Payment_Type as "metric", count(*) as "value"
FROM
sales
GROUP BY "time", "metric"
ORDER BY "time"

Simple table

Config

Build

Docker (Grafana 6.7.4)

http://your-server:3000 (admin/admin)

After starting container go to the showcase dashboard: http://your-host:3000/d/DTRcLsVGk/showcase-sales?orgId=1

Prev version

Example data set: /data
Icon: https://freeicons.io/vector-file-types-icons/csv-icon-2272