Telegraf is an open source agent that is used to collect data. Telegraf helps minimize memory consumption. You can use the plug-ins provided by Telegraf to collect the metrics from different services and third-party components. Telegraf has built-in plug-ins that can send the collected data to OpenTSDB. Lindorm TSDB is fully compatible with OpenTSDB. Therefore, you can connect Telegraf to an ApsaraDB for Lindorm (Lindorm) TSDB instance.

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

Before you begin

  1. Make sure that your existing application environment to be detected is connected to the Internet and has a public IP address.
  2. Create a Lindorm TSDB 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 Lindorm TSDB instance.
    • On the instance management page in the Lindorm console, the entry point for applying for a public IP address for a Lindorm TSDB instance is displayed, as shown in the following figure. Apply for a public IP address
    • The following figure shows the dialog box that is used to configure the IP address whitelist of a Lindorm TSDB instance. Whitelist of the Lindorm TSDB instance
  3. After you apply for a public IP address for the Lindorm TSDB instance, make sure that the application environment can connect to the public domain name of your Lindorm TSDB instance. After the Lindorm TSDB instance is assigned a public IP address, the domain name and port of the Lindorm TSDB instance appear on the instance management page, as shown in the following figure. Public IP address

Install Telegraf

The method of installing 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 the Lindorm TSDB instance

  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]] 
      ... 
      [[outputs.opentsdb]] 
      ......
  3. Configure the outputs.opentsdb plug-in.
    • Configure the domain name and port of the Lindorm TSDB instance. The following sample code provides an example of how to configure these parameters:
       host = "http://{Lindorm TSDB instance ID}.hitsdb.rds.aliyuncs.com" 
       port = 3242
      Note The domain name must be prefixed with http://. Port 3242 is the default public port of a Lindorm TSDB instance on Alibaba Cloud.
    • Configure an HTTP API to report data. To enable an HTTP interface, uncomment the following line: http_path = "/api/put". You can also set the http_batch_size parameter to the number of data points to be written at a time.
    • Specify a delimiter that is used to separate the metrics. You can set the separator parameter to specify the delimiter. You can use only the delimiters that are supported by Lindorm TSDB. For more information, see Write single-value data points.
    • For more information about the other configuration items, see Telegraf documentation.
  4. Start Telegraf to report data. After Telegraf starts to report data, you can view the details of data writing on the instance monitoring page in the Lindorm console. To go to the instance monitoring page, perform the following steps: On the product landing page of Lindorm, click Console. In the left-side navigation pane, click Instance list. Then, click Instance Monitoring. Instance monitoring pageCloud Monitor