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
-
If you haven’t done so already, configure Astra DB to export metrics to Prometheus.
To add a Prometheus metrics export destination to a database, send a
POST
request to the DevOps API Configure Telemetry endpoint. The request body must contain the database’s entire telemetry configuration, including all existing destinations, as returned by the Get Telemetry Configuration endpoint.curl -sS --location -X POST "https://api.astra.datastax.com/v2/databases/ASTRA_DB_ID/telemetry/metrics" \ --header "Authorization: Bearer APPLICATION_TOKEN" \ --header "Accept: application/json" \ --data '{ "prometheus_remote": { "endpoint": "PROMETHEUS_URL", "auth_strategy": "basic", "password": PROMETHEUS_PASSWORD, "user": PROMETHEUS_USERNAME } }'
Set the
data
parameters to the values that you retrieved from Grafana Cloud.A successful response returns a
202 Accepted
status code. -
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.