# Connect Data Visualization Tools

After configuring the `metrics` database, you can connect data visualization tools such as Grafana to your cluster’s monitoring data. Grafana provides dashboards for advanced analytics and troubleshooting.

> **📝 Note**: To monitor multiple Source clusters, be sure to name each Source cluster to identify the cluster in the visualization tool. The Source cluster name can be set using the `cluster_name` sync variable. (For more information, see [Sync Variables Lists](https://docs.singlestore.com/db/v9.1/reference/configuration-reference/engine-variables/list-of-engine-variables/#sync-variables-lists.md).)To perform this action, connect to the Master aggregator of the Source cluster and run the following SQL command:`SET GLOBAL cluster_name='source_cluster_name';`Alternatively, you can run the following Toolbox command on a host where Toolbox is set up to manage the Source cluster:`sdb-admin update-config --key cluster_name --value 'source_cluster_name'`

## Configure Grafana

**Note**: If you already have Grafana installed, you may skip to [Add the Grafana Monitoring Data Source](https://docs.singlestore.com/#UUID-308dd3fc-aa33-87ca-1857-cb526ea1d910.md).

## Install Grafana

If a Grafana instance is not already available, [install the latest version of Grafana](https://grafana.com/docs/installation/) on any computer that can connect to the `metrics` cluster.

## Add the Grafana Monitoring Data Source

1. Connect to Grafana at `http://<grafana-hostname>:3000` and log in using `admin` as both the username and password.

2. [Add a “monitoring” MySQL data source](https://grafana.com/docs/grafana/latest/features/datasources/add-a-data-source/) with the following settings. The SingleStore data source port is `3306` by default.

   * Data source name: `monitoring`
   * Data source type: `mysql`
   * Data source host: `<any-metrics-cluster-aggregator-host-or-a-load-balancer>`
   * Data source port: `3306`
   * Database name: `metrics`
   * User: Either `root` or the monitoring user specified earlier
   * Password: Either a secure password or blank if none

3. **Alternatively**, edit the `sample.yaml` file in the `/etc/grafana/provisioning/datasources` directory and add the following content, substituting the values in angle brackets with your SingleStore configuration.
   ```yaml
   # # config file version

   apiVersion: 1

   datasources:
     - name: monitoring
       type: mysql
       url: <any-metrics-cluster-aggregator-host-or-a-load-balancer>:<port>
       database: metrics
       user: Either root or the monitoring user specified earlier
       secureJsonData:
           password: Either a secure-password or blank if none
       isDefault: true
       version: 1

   ```

4. Restart the Grafana server.
   ```shell
   sudo systemctl restart grafana-server

   ```

## Connect the Grafana Dashboards

> **📝 Note**: You may need Editor privileges to create new Grafana dashboards.

1. [Download the cluster monitoring dashboards](https://assets.contentstack.io/v3/assets/bltac01ee6daa3a1e14/blt1c787c0d2aa57046/toolbox_dashboards_85_and_later.zip) from SingleStore.

2. Import the dashboards into Grafana. To import a dashboard, click the `+` icon in the side menu, and then click **Import**. From here you can upload a dashboard JSON file, paste a Grafana.com dashboard URL, or paste dashboard JSON text directly into the text area.

3. **Alternatively**, edit the `sample.yaml` file in the `/etc/grafana/provisioning/dashboards/` directory and add the following content.
   ```yaml
   # # config file version
   apiVersion: 1

   providers:
   - name: 'default'
     orgId: 1
     folder: ''
     folderUid: ''
     type: file
     options:
       path: /var/lib/grafana/dashboards

   ```
   Next, copy the dashboard JSON files to the `/var/lib/grafana/dashboards` directory and ensure that the dashboards are owned by `grafana:grafana` (via `chown grafana:grafana *`).

4. Restart the Grafana server.
   ```shell
   sudo systemctl restart grafana-server

   ```

## View Monitoring Data from Multiple Clusters (Optional)

You can view monitoring data from multiple source clusters in a single Grafana instance using the following steps:

1. Ensure that all cluster monitoring data is stored in a single database (on the `metrics` cluster). This will allow a single Grafana datasource to be configured.

2. On each source cluster, [enable the exporter process](https://docs.singlestore.com/db/v9.1/user-and-cluster-administration/cluster-health-and-performance/configure-monitoring/configure-monitoring-with-toolbox.md).

3. On the `metrics` cluster, run [sdb-admin start-monitoring](https://docs.singlestore.com/db/v9.1/reference/singlestore-tools-reference/sdb-admin-commands/start-monitoring.md) for each source cluster and store the monitoring data in the same database.

4. Name each Source cluster to allow Grafana to identify the cluster. For more information, see [Note](https://docs.singlestore.com/#note-idm73267386025390.md).

5. Use the **cluster** tab in the Grafana UI to toggle between monitoring data from each source cluster.

   ![](https://images.contentstack.io/v3/assets/bltac01ee6daa3a1e14/blt75b50c4df5ba6d0e/6a2c424b7b02a4467d645599/16083b57947b91-kAEtgT.png)

## Related Resources

* [Additional information on Grafana](https://grafana.com/)

***

Modified at: October 24, 2024

Source: [/db/v9.1/user-and-cluster-administration/cluster-health-and-performance/configure-monitoring/connect-data-visualization-tools/](https://docs.singlestore.com/db/v9.1/user-and-cluster-administration/cluster-health-and-performance/configure-monitoring/connect-data-visualization-tools/)

(An index of the documentation is available at /llms.txt)
