Telegraf is an open source agent that is used to collect data. You can use the plug-ins provided by Telegraf to collect metrics from different services and third-party components. You can use the built-in plug-ins provided by Telegraf to import the collected data to OpenTSDB. LindormTSDB is fully compatible with OpenTSDB. You can connect Telegraf to LindormTSDB.

This topic describes how to deploy Telegraf to your existing application environment and connect Telegraf to a LindormTSDB instance on Alibaba Cloud. After you perform these operations, the LindormTSDB instance can receive monitoring data from Telegraf.

Prerequisites

  1. The application environment that you want to monitor is connected to the Internet and assigned a public IP address.
  2. Create a LindormTSDB instance on Alibaba Cloud based on your business requirements and apply for a public IP address for the instance. Then, add the public IP address of the application environment to the whitelist of the LindormTSDB instance.
    • Apply for a public endpoint on the Time Series Engine page of the Lindorm cluster. The following figure shows how to apply for a public endpoint. Apply for a public IP address
    • Configure a whitelist for the Lindorm cluster. The following figure shows how to configure a whitelist. Whitelist
  3. After you apply for a public endpoint for the Lindorm cluster, make sure that the application environment can connect to the public endpoint. After you apply for a public endpoint for the Lindorm cluster, you can view the endpoint and port of the cluster on the Time Series Engine page. The following figure shows how to view the endpoint in the console. Public endpoint

Install Telegraf

The method that is used to install Telegraf varies based on the platform where your application environment is deployed. For more information about how to select a suitable method, see Telegraf documentation.

Connect Telegraf to LindormTSDB

  1. In the telegraf.conf configuration file of Telegraf, find the OUTPUT PLUGINS section.
  2. Disable the output.influxdb plug-in and enable the output.opentsdb plug-in.
      ...... 
      #[[outputs.influxdb]] 
      (details are not displayed) 
      [[outputs.opentsdb]] 
      ......
  3. Configure parameters for the outputs.opentsdb plug-in.
    • Specify the endpoint and port of the Lindorm cluster. The following code block provides an example:
       host = "http://{The ID of the Lindorm cluster}.hitsdb.rds.aliyuncs.com" 
       port = 3242
      Note The endpoint must be prefixed with http://. Port 3242 is the default public port of a LindormTSDB instance on Alibaba Cloud.
    • Configure an HTTP API to collect data. To collect data to Telegraph, specify http_path = "/api/put". You can also set the http_batch_size parameter to specify the number of data points to be written in each batch.
    • Specify a delimiter that is used to separate metrics when Telegraf writes data. You can set the separator parameter to specify a delimiter. You can use only the delimiters that are supported by LindormTSDB. For more information, see Write single-value data points.
    • For more information about other configuration items, see Telegraf documentation.
  4. Start Telegraf to collect data. After Telegraf starts to collect data, you can view the collected data on the Instance Monitoring page of the Lindorm cluster. To go to the Instance Monitoring page, log on to the Lindorm console, click the ID of the Lindorm cluster, and then click Instance Monitoring in the left-side navigation pane. Monitoring pageCloudMonitor