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.)

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.

Install Grafana

If a Grafana instance is not already available, install the latest version of Grafana 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 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.

    # # 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.

    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 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.

    # # 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.

    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.

  3. On the metrics cluster, run sdb-admin start-monitoring 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.

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

Last modified: October 24, 2024

Was this article helpful?