All Products
Document Center

Connect Telegraf to TSDB

Last Updated: May 19, 2022

Telegraf is an open source agent for data collection. Telegraf is designed to minimize memory consumption. You can use the plug-ins offered by Telegraf to build services and third-party components that can collect metric data. The built-in plug-ins of Telegraf can report the collected data to OpenTSDB. Lindorm Time Series Database (TSDB) is fully compatible with OpenTSDB. Therefore, you can connect Telegraf to TSDB.

This topic describes how to deploy Telegraf in your existing application environment and connect Telegraf to your Internet-facing TSDB instance. After you connect Telegraf to your TSDB instance, your TSDB instance can receive monitoring data from Telegraf.

Before you begin

  1. Make sure that your target application environment is connected to the Internet, and obtain a public IP address for the application environment.

  2. Create an Internet-facing TSDB instance, and apply for a public IP address for the TSDB instance. Then, add the public IP address of your target application environment to the whitelist of the TSDB instance.

  3. Make sure that your target application environment can connect to the public IP address of your TSDB instance.

Install Telegraf

The method of installing Telegraf varies based on the platform where your application environment runs. For more information about how to select a suitable method, see Installing Telegraf in the Telegraf documentation.

Connect Telegraf to TSDB

  1. Modify the telegraf.conf configuration file of Telegraf, and find the OUTPUT PLUGINS section.

  2. Disable the output.influxdb plug-in, and enable the output.opentsdb plug-in.

  3. Configure the [outputs.opentsdb] plug-in.

    1. Configure the public IP address and the port of the TSDB instance. An example is provided as follows:

      host = "http://{TSDB instance ID}"
      port = 3242

      Notes: You must add the http:// prefix to the host IP address. Otherwise, Telegraf uses telnet commands to report data. The telnet commands are not supported by TSDB.By default, port 3242 is the default port that connects TSDB instances to the Internet.

    2. Configure an HTTP API request to report data. To do this, you can uncomment the code of http_path = "/api/put" to run the code. You can also set the http_batch_size parameter to specify the number of data points that you want to write in each batch.

    3. Specify a delimiter that is used to separate the metrics. Telegraf writes the metrics to TSDB. You can set the separator parameter to specify the delimiter. You can use only the delimiters that are supported by TSDB. For more information, see Delimiters supported by TSDB.

    4. For more information about the other configuration items, see the Telegraf documentation

  4. Start Telegraf to report data. After Telegraf starts to report data, you can view the data writing details on the Instance Monitoring page of the target TSDB instance. To find the Instance Monitoring page, you can click [Console] in the upper-right corner of the TSDB homepage, and log on to the [TSDB console]. In the left-side navigation pane of the TSDB console, click [Instances]. On the page that appears, find the target instance, and click [Manage in the Actions column.]