Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/fr-ser/grafana-sqlite-datasource
This is a Grafana backend plugin to allow using a SQLite database as a data source.
Any contribution is welcome. Some information regarding the local setup can be found in the DEVELOPMENT.md file.
The most up to date (but also most generic) information can always be found here: Grafana Website - Plugin Installation
Grafana comes with a command line tool that can be used to install plugins.
grafana-cli plugins install frser-sqlite-datasource
If you need a version that is not released (yet) on the Grafana homepage or if the server where Grafana is installed has no access to the Grafana.com server, then the plugin can be downloaded and manually copied to the server.
Get the zip file from Latest release on Github
Extract the zip file into the data/plugins subdirectory for Grafana:
unzip <the_download_zip_file> -d <plugin_dir>/
Finding the plugin directory can sometimes be a challenge as this is platform and settings
dependent. A common location for this on Linux devices is /var/lib/grafana/plugins/
Restart the Grafana server
To make sure the plugin was installed, check the list of installed datasources. Click the Plugins item in the main menu. Both core datasources and installed datasources will appear.
This plugins supports ARM6 (the version running on RaspberryPi Zero W). There is a problem, though,
with Grafana supporting ARM7 (newer Raspberries) and ARM6 at the same time. Grafana chooses
the correct plugin by file name. But both ARM6 and ARM7 are named
<plugin_dir>/frser-sqlite-datasource/gpx_sqlite-datasource_linux_arm
.
Currently the ARM7 build is named like this by default, which is why the "official" plugin distribution does not support ARM6 devices.
A plugin version specifically built for ARM6 devices can be found on the Github release page (see manual installation above).
The only required configuration is the path to the SQLite database (local path on the Grafana Server)
SQLite has no native "time" format. It actually relies on strings and numbers. Since especially for time series Grafana expects an actual time type, however, the plugin provides a way to infer a real timestamp. This can be set in the query editor by providing the name of the column, which should be reformatted to a timestamp.
The plugin supports two different inputs that can be converted to a "time" depending on the type of the value in the column, that should be formatted as "time":
A number input: It is assumed to be a unix timestamp / unix epoch and will be converted to an integer before converting it to a timestamp.
A string input: The value is expected to be formatted in accordance with RFC3339,
e.g. "2006-01-02T15:04:05Z07:00"
. Edge cases might occur and the parsing library used is the
source of truth here: https://golang.org/pkg/time/#pkg-constants.
Timestamps stored as unix epoch should work out of the box, but the string formatting might require adjusting your current format. The below example shows how to convert a "date" column to a parsable timestamp:
WITH converted AS (
-- a row looks like this (value, date): 1.45, '2020-12-12'
SELECT value, date || 'T00:00:00Z' AS datetime FROM raw_table
)
SELECT datetime, value FROM converted ORDER BY datetime ASC
This plugins supports plugins inspired by the built-in Grafana datasources (e.g. https://grafana.com/docs/grafana/latest/datasources/postgres/#macros).
However, as each macro needs to be re-implemented from scratch only the following macros are supported. Other macros (that you might expect from other SQL databases) do not work
Example: $__unixEpochGroupSeconds("time", 10)
Will be replaced by an expression usable in GROUP BY clause. For example:
cast(("time" / 10) as int) * 10
Example: $__unixEpochGroupSeconds(timestamp, 10, NULL)
Same as above but with a fill parameter so missing points in that series will be added by grafana
and NULL
will be used as value.
In case multiple time columns are provided the first one is chosen as the column to determine the gap filling. "First" in this context means first in the SELECT statement. This column to have no NULL values and must be ordered ascending.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.