Grafana+influxdb+telegraf monitor server cpu, memory and hard disk

Monitoring server status is an essential part of operation and maintenance. Usually, we use it more graphitebecause it is written in python, so it is a relatively familiar language for most operation and maintenance engineers. But graphite is old after all Now, the interface experience is not very friendly, and graphite is not too easy to deploy, which will cause some trouble for novices.

Here is another monitoring system grafana. Compared with graphite, it has great advantages, especially configuration and deployment, which is much simpler. The interface experience is very good, especially compatible with graphite data.

Since grafana only provides interface display, he needs influxdbto obtain data from it, and the data in influxdb needs to be collected from other places. The commonly used collection tools are collectdand telegraf, among which collectd is not introduced here, some data are not very suitable, and influxdb integrates telegraf plug-in itself, no special configuration is required

collectd/telegraf(收集数据)  ------->   influxdb(保存数据)  -------> grafana(显示数据)

Installation configuration

influxdb 1.x+

cd /opt
# 下载速度很慢, 建议用迅雷下载, 然后通过ftp上载到服务器
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.0.2.x86_64.rpm  
yum localinstall influxdb-1.0.2.x86_64.rpm

service influxdb start

Management background default port: 8083, we can directly access the background management data
data transfer default port: 8086, the port for other services to transfer data

telegraf 1.x+

cd /opt
# 下载速度很慢, 建议用迅雷下载, 然后通过ftp上载到服务器
wget https://dl.influxdata.com/telegraf/releases/telegraf-1.0.1.x86_64.rpm
yum localinstall telegraf-1.0.1.x86_64.rpm

cd /etc/telegraf
# 只收集cpu, 内存和硬盘的数据
telegraf -sample-config -input-filter cpu:mem:disk -output-filter influxdb > telegraf.conf
# 设置将数据传递写入influxdb服务器
vi telegraf.conf
# 将地址改成 influxdb 对应的服务器地址, 端口默认 8086, 默认数据库 telegraf

 
# 启动服务
service telegraf start

grafana 3.x +

cd /opt
# 下载速度很慢, 建议用迅雷下载, 然后通过ftp上载到服务器
wget https://grafanarel.s3.amazonaws.com/builds/grafana-3.1.1-1470047149.x86_64.rpm
yum localinstall grafana-3.1.1-1470047149.x86_64.rpm

# 启动服务
service grafana-server start
# 添加开机启动
chkconfig --add grafana-server

The default startup port is 3000, and the account password is admin by default

Use grafana

  • Create a data source

 

 
  • Create a display panel

 
  • Add a single panel

 
  • Select Define Data Source

 
  • Add data from a data source

 

The final display result:


 

Refer to official documentation

telegraph: https://docs.influxdata.com/telegraf/v1.0/
influxdb: https://docs.influxdata.com/influxdb/v1.0
grafana: http://docs.grafana.org/

Link: http://www.jianshu.com/p/dfd329d30891

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326647788&siteId=291194637