Integrating Telegraf Data

Created:2024-11-05 Last Modified:2024-11-05

This document was translated by ChatGPT

#1. Data Flow

#2. Configuring Telegraf

#2.1 Installing Telegraf

You can learn the relevant background knowledge in the Telegraf documentation (opens new window). If your cluster does not have Telegraf, you can quickly deploy Telegraf as a DaemonSet using the following steps:

# add helm chart
helm repo add influxdata https://helm.influxdata.com/

# install telegraf
helm upgrade --install telegraf influxdata/telegraf -n deepflow-telegraf-demo --create-namespace

# switch from deployment to daemonset
kubectl apply -f https://raw.githubusercontent.com/deepflowio/deepflow-demo/main/DeepFlow-Telegraf-Demo/deepflow-telegraf-demo.yaml
1
2
3
4
5
6
7
8

#2.2 Configuring Telegraf Data Output

We need to modify Telegraf's configuration to send data to the DeepFlow Agent.

First, we need to determine the address of the data listening service started by the DeepFlow Agent. After installing the DeepFlow Agent, the DeepFlow Agent Service address will be displayed, with a default value of deepflow-agent.default. If you have modified it, please fill in the actual service name and namespace in the configuration.

Next, modify Telegraf's default configuration (assuming it is in the deepflow-telegraf-demo namespace):

kubectl edit cm -n deepflow-telegraf-demo telegraf
1

In telegraf.conf, add the following configuration (please change DEEPFLOW_AGENT_SVC to the service name of deepflow-agent):

[[outputs.http]]
  url = "http://${DEEPFLOW_AGENT_SVC}/api/v1/telegraf"
  data_format = "influx"
1
2
3

#3. Configuring DeepFlow

Please refer to the section Configuring DeepFlow to complete the DeepFlow Agent configuration.

#4. Viewing Telegraf Data

Metrics from Telegraf will be stored in DeepFlow's ext_metrics database. To reduce the number of tables, DeepFlow will store all Measurements in a single ClickHouse Table, but users will still see a series of data tables corresponding to the original Telegraf Measurements. The original tags of Telegraf metrics can be referenced via tag.XXX, and metric values can be referenced via metrics.YYY. At the same time, DeepFlow will automatically inject a large number of Meta Tags and Custom Tags, allowing Telegraf-collected data to be seamlessly associated with other data sources.

Using Grafana, select the DeepFlow data source to display the search results as shown below:

Telegraf Data Integration

Telegraf Data Integration