Updated on 2025-04-10 GMT+08:00

Interconnecting with the Grafana Plug-in (Linux)

Grafana is a cross-platform open-source measurement analysis and visualization tool. It can query collected data, display the data in a visualized manner, and notify users in a timely manner.

LTS-Grafana is a plug-in of Grafana. It can analyze and display LTS data in a visualized manner.

Prerequisites

  • You have installed Grafana. The Grafana version must be 9.0.0 or later. For details, see Grafana official documentation.
  • Download the LTS-Grafana plug-in package of the pipe character version.
  • LTS-Grafana can be used only after the pipe character function has been enabled on the LTS console.

    Currently, this function is applicable only to regions LA-Mexico City2, CN East-Shanghai1, AP-Singapore, CN North-Beijing4, CN South-Guangzhou, CN East-Qingdao, CN East2, CN-Hong Kong, and CN North-Ulanqab1.

Installing the LTS-Grafana Plug-in

  1. Run the following command to decompress the LTS Grafana plug-in package to the Grafana plug-in directory:

    • Grafana installed using YUM or RPM:
      unzip LTS-Grafana-OBS-Static.2.0.6.zip -d /var/lib/grafana/plugins
    • Grafana installed using a .tar.gz file:

      {PATH_TO} indicates the Grafana installation path, and {VERSION} indicates the Grafana version.

      unzip LTS-Grafana-OBS-Static.2.0.6.zip -d {PATH_TO}/grafana-{VERSION}/plugins-bundled/internal/input-datasource

      If the system displays a message indicating that the internal/input-datasource directory does not exist, run the mkdir -p {PATH_TO}/grafana-{VERSION}/plugins-bundled/internal/input-datasource command to create the directory.

  2. Modify the Grafana configuration file.

    • Open the configuration file:
      • Grafana installed using YUM or RPM: vim /etc/grafana/grafana.ini
      • Grafana installed using a .tar.gz file: vim {PATH_TO}/grafana-{VERSION}/conf/defaults.ini
    • Configure the allow_loading_unsigned_plugins parameter in the [plugins] section of the configuration file.
      allow_loading_unsigned_plugins = hw-hws-lts-grafana-datasource-plugin

      If the Grafana process is running, you are advised to run the kill command to stop it.

  3. Run the following commands to start Grafana:

    • Grafana installed using YUM or RPM:
      systemctl restart grafana-server
    • Grafana installed using a .tar.gz file:
      ./bin/grafana-server web

Adding a Data Source

  1. In the navigation pane on the left, click and choose Data sources. On the Data sources page that is displayed, click Add data source to add a data source and select hws-lts-grafana-datasource-plugin.

  2. Configure the data source.

    Table 1 Data source configuration

    Parameter

    Description

    Example Value

    Name

    Plug-in name, which can be customized.

    hws-lts-grafana-datasource-plugin

    Endpoint

    Select an endpoint based on your region. For details, see Regions and Endpoints.

    -

    AccesskeyId/SecretAccessKey

    User access credential. Log in to the LTS console, move the cursor to the account name and choose My Credentials > Access Keys. On the Access Keys page, copy the access key ID.

    -

    Specify Project ID

    • If there are multiple project IDs and you want to use a custom project, enable Specify Project ID to specify the required project ID.
    • If there is one project ID and Specify Project ID is disabled, the default project ID is used.

    -

    projectId

    If Specify Project ID is enabled, you need to enter the project ID of the account.

    Log in to the LTS console, move the cursor to the account name and choose My Credentials > API Credentials. On the API Credentials page, copy the project ID of the region.

    -

  3. Set a proxy. If a proxy is required, enable the proxy settings. If no proxy is required, skip this step.

    Table 2 Proxy settings

    Parameter

    Description

    Example Value

    Scheme

    Protocol

    HTTP, HTTPS, etc.

    Host

    Domain name/IP address

    -

    port

    Port

    80

    userName

    Username

    If the proxy has a username, you need to enter its username.

    If the proxy has no username set, leave this parameter blank.

    -

    password

    Password

    If the proxy has a password, you need to enter its password.

    If the proxy has no password set, leave this parameter blank.

    -

  4. Add a dashboard.

    1. In the navigation pane on the left, choose Dashboards. On the New dashboard page, click add an empty panel.
    2. On the New dashboards page, select hws-lts-grafana-datasource-plugin and enter the corresponding SQL statement.
    3. Select the corresponding time in the upper right corner and click to refresh and display the latest data.

      Follow the following rules when configuring parameters of the LTS-Grafana plug-in:

      • For table data, set the x-column parameter to table.
      • For single-value data, set the x-column parameter to single.
      • For charts that contain dimension columns, set the x-column parameter to the time column field and y-column to col1:col2. col1 indicates the aggregation column, and col2 indicates the data column.
      • For bar charts, set the x-column parameter to bar and y-column to col1,col2. col1 indicates the category column, and col2 indicates the data column.
      • For pie charts, set the x-column parameter to pie and y-column to col1,col2. col1 indicates the category column, and col2 indicates the data column.