概念说明:Telegraf 是一个用 Go 编写的代理,用于收集指标并将它们写入 InfluxDB 或其他可能的输出。
安装Telegraf:
cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
[influxdb]
name = InfluxDB Repository - RHEL \$releasever
baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable
enabled = 1
gpgcheck = 1
gpgkey = https://repos.influxdata.com/influxdb.key
EOF
sudo yum install telegraf
Configure your API Token:
export INFLUX_TOKEN=i4YNV7VSx0GA8p1MuM-pYlqiy9QjMBlvOSjma87cWGOJFGn6ioBsGLJ1d-wY95V9yAUwA0XVQWEK47MRsCKGtw==
Start Telegraf:
telegraf --config http://124.222.138.109:8086/api/v2/telegrafs/08eca46c41ae3000
查看数据: