OceanBase Cloud supports collecting database monitoring metrics via Prometheus and displaying them using Grafana dashboards. This guide walks you through configuring a Grafana dashboard to visualize monitoring data for an OceanBase Cloud database.
Prerequisites
You have already set up Prometheus to collect monitoring metrics. For detailed steps, refer to Monitor data of OceanBase Cloud with Prometheus.
You have deployed Grafana and ensured that Grafana and Prometheus can communicate. This guide uses Grafana version 10.2.2 deployed via Docker as an example, but you may use other methods, such as local installation or a managed service.
You have downloaded the OceanBase Cloud monitoring dashboard configuration files: Host Monitoring and Instance Monitoring. These are pre-configured example dashboards, but you can also customize them as needed.
Procedure
Step 1: Start and log in to Grafana
If you are deploying Grafana using Docker, run the following command to start Grafana:
sudo docker run -d --name=grafana-test -p 3000:3000 grafana/grafana:10.2.2 # The `--name` parameter defines the container name, which in this example is `grafana-test`. You can customize it as needed.Access Grafana in your browser at
http://localhost:3000. The default username and password are bothadmin. When you log in for the first time, Grafana will prompt you to change the password.
Step 2: Add Prometheus as a data source
After logging in, click the
icon in the top-left corner to expand the sidebar, then select Connections > Data sources.Click Add data source, then select Prometheus as the data source.
In the Connection section of the Prometheus configuration page, enter the URL of your Prometheus server. Scroll to the bottom of the page and click Save & test to validate the connection.
Step 3: Configure the Grafana dashboard
Click the
icon again to open the sidebar, then select Dashboards.Click + Create Dashboard, then in the Import a dashboard card, click Import Dashboard.
Upload one of the pre-downloaded dashboard configuration files mentioned in the prerequisites, then click Load.
On the Options page, enter a custom name for the dashboard and click Import. You should now be able to view your monitoring data on the Grafana dashboard.