steampipe plugin install grafana

Grafana + Steampipe

Grafana is a cloud hosting company that provides virtual private servers and other infrastructure services.

Steampipe is an open-source zero-ETL engine to instantly query cloud APIs using SQL.

List dashboards in your Grafana account:

select
id,
title,
url
from
grafana_dashboard
+----+--------------+---------------------------+
| id | title | url |
+----+--------------+---------------------------+
| 3 | my dashboard | /d/Y4EbrQV7k/my-dashboard |
+----+--------------+---------------------------+

Documentation

Get started

Install

Download and install the latest Grafana plugin:

steampipe plugin install grafana

Configuration

Installing the latest grafana plugin will create a config file (~/.steampipe/config/grafana.spc) with a single connection named grafana:

connection "grafana" {
plugin = "grafana"
# URL of the Grafana installation
url = "http://localhost:3000"
# Authentication - API key
auth = "eyJrIjoidGQ3VlMwVjlFVVc1TVNncjVWNGVYZnNDcaZIQkp2U2giLCJuIjoidGVzdDIsImlkIjoxfQ=="
# Alternate authentication - username and password
# auth = "admin:admin"
}
  • url (required) - Root URL of a Grafana server. May alternatively be set via the GRAFANA_URL environment variable.
  • auth (required) - API token or basic auth username:password. May alternatively be set via the GRAFANA_AUTH environment variable.
  • ca_cert - Certificate CA bundle to use to verify the Grafana server's certificate. May alternatively be set via the GRAFANA_CA_CERT environment variable.
  • insecure_skip_verify - Skip TLS certificate verification. May alternatively be set via the GRAFANA_INSECURE_SKIP_VERIFY environment variable.
  • org_id - The organization id to operate on within grafana. May alternatively be set via the GRAFANA_ORG_ID environment variable.
  • tls_cert - Client TLS certificate file to use to authenticate to the Grafana server. May alternatively be set via the GRAFANA_TLS_CERT environment variable.
  • tls_key - Client TLS key file to use to authenticate to the Grafana server. May alternatively be set via the GRAFANA_TLS_KEY environment variable.

Postgres FDW

This plugin is available as a native Postgres FDW. Unlike Steampipe CLI, which ships with an embedded Postgres server instance, the Postgres FDW can be installed in any supported Postgres database version.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_postgres_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/postgres.sh)" -- grafana

The installer will prompt you for the plugin name and version, download and install the appropriate files for your OS, system architecture, and Postgres version.

To configure the Postgres FDW, you will create an extension, foreign server, and schema and import the foreign schema.

CREATE EXTENSION IF NOT EXISTS steampipe_postgres_grafana;
CREATE SERVER steampipe_grafana FOREIGN DATA WRAPPER steampipe_postgres_grafana OPTIONS (config '<your_config>');
CREATE SCHEMA grafana;
IMPORT FOREIGN SCHEMA grafana FROM SERVER steampipe_grafana INTO grafana;

SQLite Extension

This plugin is available as a SQLite Extension, making the tables available as SQLite virtual tables.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_sqlite_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/sqlite.sh)" -- grafana

The installer will prompt you for the plugin name, version, and destination directory. It will then determine the OS and system architecture, and it will download and install the appropriate package.

To configure the SQLite extension, load the extension module and then run the steampipe_configure_grafana function to configure it with plugin-specific options.

$ sqlite3
sqlite> .load ./steampipe_sqlite_extension_grafana.so
sqlite> select steampipe_configure_grafana('<your_config>');

Export

This plugin is available as a standalone Export CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- grafana

You can pass the configuration to the command with the --config argument:

steampipe_export_grafana --config '<your_config>' <table_name>