Grafana connection

更新时间:
复制 MD 格式

This topic shows you how to connect an AnalyticDB for PostgreSQL instance to Grafana for visual analysis.

Prerequisites

A Grafana service is required. You can quickly create a Grafana service on Alibaba Cloud.

Procedure

  1. Log on to the Managed Service for Grafana console.

  2. In the left-side navigation pane, under Grafana Service, click Workspace Management. Then, click the ID of your target workspace.

  3. On the Workspace Management page, copy the Public IP Address or Private IP Address of Grafana and add it to the whitelist of the AnalyticDB for PostgreSQL instance to access the AnalyticDB for PostgreSQL instance. For more information, see Configure a whitelist. This example uses a public IP address to connect.

  4. On the Workspace Management page, click Public Endpoint to access Grafana.

    Note

    Log on to Grafana with the Admin account and password you set when you created the workspace.

  5. In the left-side navigation pane of Grafana, click the p336428..png icon and choose Data Source.

  6. Click Add data source, and then select PostgreSQL.

  7. Enter the connection information. The following table describes the parameters.

    Parameter

    Description

    Name

    A display name for this data source.

    Network type

    The network type (public or private).

    Host

    The endpoint of the AnalyticDB for PostgreSQL instance. The format is <host>:<port>. Example: gp-bp10vkbe1x1v3h****-master.gpdb.rds.aliyuncs.com:5432.

    Database

    The name of the AnalyticDB for PostgreSQL database.

    User

    The username for the AnalyticDB for PostgreSQL database account.

    Password

    The password for the AnalyticDB for PostgreSQL database account.

    TLS/SSL mode

    Select disable. You can also configure this setting as needed.

    Version

    Select PostgreSQL version 9.4.

    Other parameters

    For descriptions of other parameters, see the Grafana PostgreSQL data source documentation.

  8. At the bottom of the page, click Save & Test.

    If the page displays Database Connection OK, the connection is successful.

  9. You can now analyze your data in Grafana. For more information, see the Grafana getting started documentation.

    In the Grafana panel editor, select PostgreSQL as the data source and configure the query. In the FROM section, select a data table, set Time column to time, and set Metric column to none. In the SELECT section, set Column to value. In the WHERE section, use the $_timeFilter macro. For Format as, select Time series. After completing the configuration, the panel displays a time series line chart.