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:
grafana cli --pluginUrl https://github.com/GreptimeTeam/greptimedb-grafana-datasource/releases/latest/download/info8fcc-greptimedb-datasource.zip plugins install info8fcc
Configuring the Connection
- Enter the GreptimeDB server URL, e.g.,
http://<host>:4000
. - Enter the database name, default as
public
. - If authentication is required, select basic auth and enter the GreptimeDB username and password.
- 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:
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.
- Enter
http://localhost:3000
to open the Grafana interface. - The default username and password are both
admin
. - 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.
Users need to pay attention to the following two key configurations.
- Configure Prometheus Remote-Write to Upload Data to GreptimeDB:
remote_write:
- url: http://greptimedb:4000/v1/prometheus/write?db=public
- Grafana Configuration:
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:
- Configure Prometheus Remote Write/Read
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: ********
- Configure GreptimeDB Data Source Plugin Connection
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.
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.