Integrate Grafana Cloud with Astra DB Serverless
Grafana Cloud can consume and visualize Astra DB Serverless health metrics.
Prerequisites
-
You exported metrics to a third-party observability service. This guide assumes that you exported metrics to Prometheus, but you can also export metrics to Kafka, Amazon CloudWatch, Splunk, Pulsar, and Datadog.
-
You have a Grafana Cloud account.
-
You have an application token.
Generate a Grafana Cloud config file
You must generate a config file to view metrics from Prometheus:
-
Sign in to your Grafana Cloud account, and then add a connection.
-
Search for
Prometheus
, and then select Hosted Prometheus metrics. -
Specify a Token name, and then create the token.
The config file is generated. Here’s an example config file:
cat << EOF > ./agent-config.yaml
metrics:
global:
scrape_interval: 60s
configs:
- name: hosted-prometheus
scrape_configs:
- job_name: node
static_configs:
- targets: ['localhost:9100']
remote_write:
- url: PROMETHEUS_WRITE_METRICS_URL
basic_auth:
username: PROMETHEUS_USER_NAME
password: PROMETHEUS_PASSWORD
EOF
Export metrics from Astra DB Serverless
You can use Postman and the DevOps API to configure and publish metrics from Astra DB Serverless:
-
To publish metrics, create a
POST
request in Postman to the following URL:https://api.astra.datastax.com/v2/databases/{DATABASE_ID}/telemetry/metrics
-
In the Body, set the parameters to the values that you retrieved from Grafana Cloud:
{ "prometheus_remote": { "endpoint": "PROMETHEUS_URL", "auth_strategy": "basic", "user": "PROMETHEUS_USER_NAME", "password": "PROMETHEUS_PASSWORD" } }
The
POST
response returns a202 Accepted
status code on success. -
In Grafana Cloud, create a dashboard.
-
Select your Prometheus data source, and then select Code mode.
If configured correctly, the Astra DB Serverless metrics are shown under the Metrics Browser.
-
Select the metrics that you want to visualize in Grafana Cloud.
Create an Astra DB Serverless dashboard from a template
You can use a template to create a Astra DB Serverless dashboard in Grafana Cloud.
This option is for Serverless (Non-Vector) databases only.
Before using the template, you must Generate a Grafana Cloud config file and Export metrics from Astra DB Serverless.
-
In your Grafana Cloud instance, import a dashboard.
-
Upload or enter the grafana_dashboard.json template.
-
Click Load.
Once imported, your Serverless (Non-Vector) health charts autopopulate in Grafana Cloud.