一、telegraf简介:
Telegraf 是一个用 Go 编写的代理程序,可收集系统和服务的统计数据,并写入到 InfluxDB 数据库。
Telegraf 具有内存占用小的特点,通过插件系统开发人员可轻松添加支持其他服务的扩展。
官网地址:https://docs.influxdata.com/telegraf/v1.2/introduction/getting_started/
二、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 yum install telegraf Redhat6 service telegraf start Redhat7+ systemctl start telegraf Or telegraf -config telegraf.conf
三、配置InfluxDB
1、InfluxDB安装请参考(http://www.along.party/?p=219)
vim /etc/telegraf/telegraf.conf
# netstat -ntlpa|grep 8086 tcp 0 0 192.168.62.200:55319 192.168.62.200:8086 ESTABLISHED 28145/telegraf tcp 0 0 :::8086 :::* LISTEN 27573/influxd tcp 0 0 ::ffff:192.168.62.200:8086 ::ffff:192.168.62.200:55319 ESTABLISHED 27573/influxd
可以看到telegraf已经跟influxd建立连接
登录influxdb管理界面查看数据
查看Cpu
查看磁盘io
telegrfa默认开启下列几项系统性能收集,telegrfa也可以自定义收集应用服务性能数据
[[inputs.cpu]] percpu = true totalcpu = true collect_cpu_time = false [[inputs.disk]] ignore_fs = ["tmpfs", "devtmpfs"] [[inputs.diskio]] [[inputs.kernel]] [[inputs.mem]] [[inputs.processes]] [[inputs.swap]] [[inputs.system]]
四、配置Grafana
1、Grafana安装请参考(http://www.along.party/?p=70)
2、配置InfluxDB数据源
3、新建Dashboard
由于刚弄InfluxDB数据源,图形比较粗糙,索引展示一个以zabbix为数据源的Grafana图形