Join us for a virtual meetup on Zoom at 8 PM, July 31 (PDT) about using One Time Series Database for Both Metrics and Logs 👉🏻 Register Now

Skip to content
On this page
Announcement
June 28, 2024

Introducing Grafana GreptimeDB Data Source Plugin — Alternative for Prometheus Plugin

This article introduces why and how we built the Grafana GreptimeDB Data Source Plugin and explains how to integrate and use it with GreptimeDB and GreptimeCloud.

Previously, users could use the Prometheus data source plugin to connect to GreptimeDB for PromQL queries.

GreptimeDB achieves more than 80% PromQL compliance and thus can be connected via the Prometheus plugin. However, since GreptimeDB utilizes a multi-value model rather than Prometheus' single-value model, and GreptimeDB supports various advanced features, using the Grafana Prometheus data source plugin for GreptimeDB connection cannot unleash its full potential.

Therefore, we developed the Grafana GreptimeDB data source plugin based on the Prometheus data source plugin. This plugin natively supports all features of GreptimeDB, such as the multi-value model and SQL queries. Additionally, compared to directly using the Prometheus data source, it also addresses compatibility issues.

Building on the Prometheus Data Source Plugin

We modified the Grafana Prometheus built-in data source plugin, which is integrated into Grafana and cannot run independently as a standard plugin.

To make the GreptimeDB plugin run as a standard plugin, we made the following changes:

  • Addressed front-end dependency issues: resolved dependency path changes using Webpack alias and refined some code to reduce unnecessary dependencies.
  • Implemented the backend Go functions (the plugin itself does not contain related Go code).

Installing the Plugin

You can install the GreptimeDB data source plugin using one of the following methods.

The first approach is to download the latest version and extract the files to your Grafana plugin directory.

A download URL example can be: https://github.com/GreptimeTeam/greptimedb-grafana-datasource/releases/tag/v1.0.37.

The other approach is to use the Grafana CLI tool to download and install:

shell
grafana cli --pluginUrl https://github.com/GreptimeTeam/greptimedb-grafana-datasource/releases/latest/download/info8fcc-greptimedb-datasource.zip plugins install info8fcc

Configuring the Connection

  1. Enter the GreptimeDB server URL, e.g., http://<host>:4000.
  2. Enter the database name, default as public.
  3. If authentication is required, select basic auth and enter the GreptimeDB username and password.
  4. Click the Save & Test button to test the connection.

Setting Up Node Exporter Dashboard with Local GreptimeDB

In the GreptimeDB data source plugin repository, we provide a ready-to-use Docker Compose configuration file that can start GreptimeDB, Prometheus, Prometheus Node Exporter, Grafana, and this plugin with one command.

Clone the repository and run Docker Compose to start the services:

bash
git clone https://github.com/GreptimeTeam/greptimedb-grafana-datasource.git
cd greptimedb-grafana-datasource/docker
docker compose up

Using the above configuration, you can directly run and view the results with the built-in GreptimeDB Data Source Connection and Node Exporter Dashboard.

  1. Enter http://localhost:3000 to open the Grafana interface.
  2. The default username and password are both admin.
  3. On the Dashboards page, you can see the Node Exporter Full dashboard.

TIP

If the dashboard does not display Node Exporter Full, ensure that the Starred filter is not selected.

Select Node Exporter Full dashboard
Select Node Exporter Full dashboard
Node Exporter Full dashboard
Node Exporter Full dashboard

Users need to pay attention to the following two key configurations.

  1. Configure Prometheus Remote-Write to Upload Data to GreptimeDB:
yaml
remote_write:
  - url: http://greptimedb:4000/v1/prometheus/write?db=public
  1. Grafana Configuration:
yaml
grafana:
    image: grafana/grafana:latest
    container_name: grafana_info8fcc
    ports:
      - 3000:3000
    environment:
     - GF_INSTALL_PLUGINS=https://github.com/GreptimeTeam/greptimedb-grafana-datasource/releases/latest/download/info8fcc-greptimedb-datasource.zip;info8fcc // 安装插件
    volumes:
      - ../provisioning:/etc/grafana/provisioning // 使用预制 provision
    networks:
      - datasource-network

Connecting to GreptimeCloud with the GreptimeDB Data Source Plugin

After installing the Prometheus client and Node Exporter client, data can be uploaded to GreptimeCloud. Users need to pay attention to the following two key configurations:

  1. Configure Prometheus Remote Write/Read
yaml
remote_write:
  - url: https://t3yzenagas4a.us-west-2.aws.greptime.cloud/v1/prometheus/write?db=lpw7na1gmw4gcool_debt-public
    basic_auth:
      username: NXOZb0pywez9y5LpGNFXvSAM
      password: ********

remote_read:
  - url: https://t3yzenagas4a.us-west-2.aws.greptime.cloud/v1/prometheus/read?db=lpw7na1gmw4gcool_debt-public
    basic_auth:
      username: NXOZb0pywez9y5LpGNFXvSAM
      password: ********
  1. Configure GreptimeDB Data Source Plugin Connection
GreptimeCloud connection info
GreptimeCloud connection info

TIP

Please ensure that the Host corresponds to the GreptimeDB server URL and should includes the https:// prefix.

Log in to GreptimeCloud, click Connection Information to get the configuration details.

GreptimeCloud connection info
GreptimeCloud connection info

Now you can query data on GreptimeCloud using the GreptimeDB data source plugin.


About Greptime

We help industries that generate large amounts of time-series data, such as Connected Vehicles (CV), IoT, and Observability, to efficiently uncover the hidden value of data in real-time.

Visit the latest version from any device to get started and get the most out of your data.

  • GreptimeDB, written in Rust, is a distributed, open-source, time-series database designed for scalability, efficiency, and powerful analytics.
  • Edge-Cloud Integrated TSDB is designed for the unique demands of edge storage and compute in IoT. It tackles the exponential growth of edge data by integrating a multimodal edge-side database with cloud-based GreptimeDB Enterprise. This combination reduces traffic, computing, and storage costs while enhancing data timeliness and business insights.
  • GreptimeCloud is a fully-managed cloud database-as-a-service (DBaaS) solution built on GreptimeDB. It efficiently supports applications in fields such as observability, IoT, and finance.

Star us on GitHub or join GreptimeDB Community on Slack to get connected. Also, you can go to our contribution page to find some interesting issues to start with.

Grafana plugin
Prometheus

Join our community

Get the latest updates and discuss with other users.