Grafana Dashboard for PlanetScale Branches
Introduction
In this tutorial, you'll learn how to set up Grafana and connect it to a Prometheus instance to see metrics about your PlanetScale database. This guide requires that you've set up a Prometheus instance from our documentation.
If you're already running Grafana in production and you're just looking for our standard dashboard template, you can find it on GitHub.
Install Grafana
Grafana's installation documentation contains information for their supported platforms. For this guide, we'll be setting this up locally on a macOS machine.
If you're using a hosted Grafana option such as Grafana Cloud or AWS Managed Grafana you can skip this step.
On macOS, Grafana is availabile via homebrew, and I can install it with:
$ brew install grafana
This will download and install Grafana, and I can start it with:
$ brew services start grafana
When that succeeds, I can go to http://localhost:3000/
and I should see the Grafana welcome page:
The default username and password for a new install is admin
and admin
. Grafana will ask you to change the password the first time you log in, please pick something more secure than admin
.
Adding a Prometheus Endpoint
You can skip this step as well if you're already running a managed Prometheus or have added your datasource to Grafana already.
If you're running Prometheus locally, you'll need to add that as a datasource. To do this:
- Open the menu in the top left and click "Connections"
- Search for "Prometheus" and pick the plain "Prometheus" option
- Click "Add new data source" in the top right of the page.
Now, you should look see a page that looks like this:
You can call this whatever you want, we'll use the following:
- Name: "PlanetScale"
- Prometheus server URL:
http://localhost:9090/
Because this is running on your local machine, we do not need to use any Authentication or TLS
Scroll down to the "Interval behaviour" section and set the "Scrape interval" to 1m
.
Finally, scroll to the bottom and click "Save & test".
Import the PlanetScale Dashboard
Now that we have our datasource added, let's import the PlanetScale Dashboard. This is a starter dashboard that PlanetScale has produced which shows an overview of your branch with the metrics that we expose.
From the Grafana homepage, go to the top left menu and pick "Dashboards".
In the top right, click "New" and then Import":
PlanetScale maintains the latest version of the dashboard located here:
https://github.com/planetscale/grafana-dashboard/blob/main/overview.json
Download this file to your computer, and then click "Upload dashboard JSON file".
Find the JSON file you downloaded in the previous step, and configure it with the Prometheus datasource that we added in an earlier:
Click 'Import' and you should be directed to the dashboard, configured to query your local Prometheus with the data it's been scraping!
Need help?
Get help from the PlanetScale Support team, or join our GitHub discussion board to see how others are using PlanetScale.