All Products
Search
Document Center

Simple Log Service:Collect metric data from ClickHouse servers

Last Updated:Feb 02, 2024

You can use Telegraf to collect metric data from ClickHouse servers. Then, you can use Logtail to send the metric data to a Metricstore in Simple Log Service. This way, you can monitor the metric data of ClickHouse servers in a visualized manner. This topic describes how to collect metric data from ClickHouse servers by using Simple Log Service and visualize the data.

Prerequisites

  • Telegraf is installed on a server that is connected to the ClickHouse server over an internal network.

  • A project and a Metricstore are created. For more information, see Create a project and Create a Metricstore.

Limit

Only Linux Logtail V0.16.48 and later can collect ClickHouse metric data. If an earlier version of Logtail is installed on your server, you must update Logtail to a supported version. For more information, see Install Logtail on a Linux server.

Procedure

  1. Log on to the Simple Log Service console.

  2. In the Import Data section, click ClickHouse Monitoring Data.

  3. Select the project and Metricstore. Then, click Next.

  4. Create a machine group.

    • If a machine group is available, click Use Existing Machine Groups.
    • If no machine groups are available, perform the following steps to create a machine group. In this example, an Elastic Compute Service (ECS) instance is used.

      1. On the ECS Instances tab, select Manually Select Instances. Then, select the ECS instance that you want to use and click Create.

        For more information, see Install Logtail on ECS instances.

        Important

        If you want to collect logs from an ECS instance that belongs to a different Alibaba Cloud account than Simple Log Service, a server in a data center, or a server of a third-party cloud service provider, you must manually install Logtail. For more information, see Install Logtail on a Linux server. After you manually install Logtail, you must configure a user identifier for the server. For more information, see Configure a user identifier.

      2. After Logtail is installed, click Complete Installation.
      3. In the Create Machine Group step, configure the Name parameter and click Next.

        Log Service allows you to create IP address-based machine groups and custom identifier-based machine groups. For more information, see Create an IP address-based machine group and Create a custom identifier-based machine group.

  5. Confirm that the machine group is displayed in the Applied Server Groups section and click Next.

    Important

    If you apply a machine group immediately after you create the machine group, the heartbeat status of the machine group may be FAIL. This issue occurs because the machine group is not connected to Simple Log Service. To resolve this issue, you can click Automatic Retry. If the issue persists, see What do I do if no heartbeat connections are detected on Logtail?

  6. In the Specify Data Source step, configure the parameters. The following table describes the parameters.

    Parameter

    Description

    Configuration Name

    The name of the Logtail configuration. You can enter a custom name.

    Cluster Name

    The name of the ClickHouse cluster. You can enter a custom name.

    After you configure this parameter, Simple Log Service adds a cluster=Cluster name tag to the ClickHouse monitoring data that is collected by using the Logtail configuration.

    Important

    Make sure that the cluster name is unique. Otherwise, data conflicts may occur.

    Username

    The username of the account that you use to connect to the ClickHouse database.

    Password

    The password of the account that you use to connect to the ClickHouse database.

    Server List

    The information about the ClickHouse database. The information includes the following configuration items:

    • Address: the address of the ClickHouse database.

    • Port: the port number of the ClickHouse database. Default value: 8123.

    You can add information about multiple ClickHouse databases based on your business requirements.

    Custom Tags

    The custom tags that are added to the collected ClickHouse monitoring data. The tags are key-value pairs.

    After you configure this parameter, Simple Log Service adds the custom tags to the ClickHouse monitoring data that is collected by using the Logtail configuration.

    Custom Telegraf Configurations

    Simple Log Service collects ClickHouse monitoring data by using Telegraf. Telegraf is an open source tool that is used to collect metrics. If the preceding default parameters do not meet your business requirements, you can use Custom Telegraf Configurations to configure custom parameters. For more information about Telegraf, see Telegraf. For more information about configuration examples, see Configuration.

    For more information about the metrics that can be collected, see Metrics.

FAQ

How can I check whether Telegraf collects data as expected?

You can check the logs of the /etc/ilogtail/telegraf/telegraf.log file on your server. You can also collect this log file to Log Service and search for the required information.

What to do next

  • Query and analyze data

    After you configure the settings, Telegraf uses Logtail to upload collected metric data to the specified Metricstore in Simple Log Service. You can query and analyze the metric data in the Metricstore. For more information, see Query and analyze metric data.

  • Visualize query and analysis results

    After you configure the settings, Simple Log Service automatically creates a dashboard named ClickHouse Monitoring Data_<Cluster name> in the related project. You can visualize query and analysis results on the dashboard. You can also configure alert rules for the dashboard.