1. telegraf安装
yum源配置
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
或者直接下载
https://repos.influxdata.com/rhel/7/amd64/stable/influxdb2-2.3.0.x86_64.rpm
2. 生成配置
选择system (监控linux系统 cpu, 内存, 磁盘, 网络等指标)
拿到token, 用于telegraf连接influxdb
查看创建的配置内容,
- 数据收集周期 10s
- 配置
token = "$INFLUX_TOKEN"
复制并覆盖/etc/telegraf/telegraf.conf
配置文件
3. 收集数据并展示
启动telegraf
systemctl start telegraf
查看dashboards