码迷,mamicode.com
首页 > 其他好文 > 详细

Telegraf安装使用

时间:2020-07-22 23:31:53      阅读:100      评论:0      收藏:0      [点我收藏+]

标签:brew   centos   SHA256   put   tput   nbsp   list   指定   配置文件   

下载地址:https://portal.influxdata.com/downloads/#telegraf

Telegraf v1.14.5

OS X(via Homebrew)

brew update
brew install telegraf

Docker Image

docker pull telegraf

Ubuntu & Debian

SHA256:12af5b582aec350038ff0258174d14b2d3a072e3ca83088df29149f4f07040b0

wget wget https://dl.influxdata.com/telegraf/releases/telegraf_1.14.5-1_amd64.deb
sudo dpkg -i telegraf_1.14.5-1_amd64.deb

RedHat & CentOS

SHA256:bc0a82ddcbf5a2214bae6b8368a53a0f89bec215b6e91b08104254023bbd5100

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.14.5-1.x86_64.rpm
sudo yum localinstall telegraf-1.14.5-1.x86_64.rpm

Windows Binaries(64-bit)

SHA256:e5648afe957aee0cabf88fbd63dad7ba2bc3dac7ede2e09b246d78a9742793f8

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.14.5_windows_amd64.zip
unzip telegraf-1.14.5_windows_amd64.zip

Linux Binaries(64-bit)

SHA256:9ba4a1e54bea0fa805872c768d05dec026e3f53b71a2f6d7673780cb93813b6d

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.14.5_linux_amd64.tar.gz
tar xf telegraf-1.14.5_linux_amd64.tar.gz

Linux Binaries(32-bit)

SHA256:0f38459b3d1c5d346c2987f58a5f96b1f64d3c09de66266c564d4e5bf4b0dd27

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.14.5_linux_i386.tar.gz
tar xf telegraf-1.14.5_linux_i386.tar.gz

Linux Binaries(ARM)

SHA256:cf1333eebb6b4c330f59b7e2a251e7b00e891eed7670c794a142a70c1712760f

wget https://dl.influxdata.com/telegraf/releases/telegraf-1.14.5_linux_armhf.tar.gz
tar xf telegraf-1.14.5_linux_armhf.tar.gz

生成配置文件

可执行文件在/usr/bin/telegraf,配置文件在/etc/telegraf目录下,也可直接配置生成

  • 查看帮助
telegraf --help
  • 生成配置文件
telegraf config > telegraf-mysql.conf   #比如在当前目录下生成mysql相关的配置文件
  • 生成指定输入和输出插件的配置文件
telegraf --input-filter <pluginname>[:<pluginname>] --output-filter <outputname>[:<outputname>] config > telegraf.conf

eg:生成带CPU、memory、disk diskio、net和influxdb插件带配置文件telegraf.conf,指定输出到influxdb和opentsdb
telegraf --input-filter cpu:mem:disk:diskio:net --output-filter influxdb:opentsdb config > telegraf.conf

 也可使用默认到配置文件

telegraf --input-filter cpu:mem:http_listener --output-filter influxdb config 
  • telegraf支持读取多个配置文件,可将多个配置文件放置在/etc/telegraf/telegraf.d目录下

测试配置是否成功

示例

# 测试 /etc/telegraf/telegraf.conf 配置文件中输入 cpu 配置是否正确
telegraf  -config /etc/telegraf/telegraf.conf -input-filter cpu -test
# 测试 /etc/telegraf/telegraf.conf 输出 influxdb 配置是否正确
telegraf  -config /etc/telegraf/telegraf.conf -output-filter influxdb -test
# 测试 /etc/telegraf/telegraf.d/mysql.conf 输入 cpu 和 输出 influxdb 配置是否正确
telegraf  -config /etc/telegraf/telegraf.d/mysql.conf -input-filter cpu  -output-filter influxdb -test
配置正确的话,会输出当前时间戳的配置指标和值;

配置错误的话,会显示错误信息;

  • 查看telegraf的日志

telegraf日志目录:/var/log/telegraf/telegraf/log

 

Telegraf安装使用

标签:brew   centos   SHA256   put   tput   nbsp   list   指定   配置文件   

原文地址:https://www.cnblogs.com/winnerREN/p/13363406.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!