Next, I wrote a blog about influxdb and how to install it. This blog introduces how to install telegraf in Linux and its features...
Official website address: influxdata
Official documentation: telegraf documentation
Environment: centos7.4 64-bit
Influxdb version: 1.0.2
1. Introduction to telegraf
1. Basic Introduction
Telegraf is a go agent that collects statistics on systems and services and writes them to the influxdb database. The memory usage is small. You can easily add extensions that support other services through the plug-in system.
Influxdb is an open-source Distributed Time Series, time, and indicator database. It is written in the go language without external dependencies. Influxdb has the following three features:
① Based on Time Series, support time-related functions (such as maximum, minimum, and sum );
② Measurable: You can calculate a large amount of data in real time;
③ Event-based: it supports any event data;
2. Why telegraf and influxdb?
① In the data collection and platform monitoring systems, telegraf can collect the running information of multiple components without the need for regular collection by hand scripts, reducing the difficulty of data acquisition;
② Telegraf is easy to configure and can be quickly started with basic Linux basics;
③ Telegraf collects data according to the time sequence, and the data structure contains the time sequence information. influxdb is designed for this type of data. Using influxdb, you can perform various analysis and computing operations based on collected data;
Ii. installation and configuration
1. Download
Official Website: telegraf
Or you can download the file through the command line. The command is as follows:
# Download installation package wget http://get.influxdb.org/telegraf/telegraf-0.11.1-1.x86_64.rpm
# Unzip sudo Yum localinstall telegraf-0.11.1-1.x86_64.rpm # Start command systemctl start telegraf # restart command systemctl restart telegraf
2. modify the configuration file
Run the vim/etc/telegraf. conf command to modify the file as follows:
[[outputs.influxdb]] urls = ["http://localhost:8086"] # required database = "telegraf" # required retention_policy = "" precision = "s" timeout = "5s" username = "telegraf" password = "password"
Save the modification, enter the command systemctl restart telegraf, and restart telegraf.
Iii. Data collection and presentation
If you want to use telegraf to collect data and save it to influxdb, you must create the corresponding user and database in influxdb.
1. Create influxdb users and databases
[[email protected]~]# influxVisit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring.Connected to http://localhost:8086 version 1.0.2InfluxDB shell version: 1.0.2> create user "telegraf" with password ‘password‘> show users;user admintelegraf false> create database telegraf> show databasesname: databases---------------name_internaltelegraf> exit[[email protected] ~]# systemctl restart influxdb
After successful creation, restart influxdb and enter the IP address + port 8083 to enter the influxdb interface.
2. query the corresponding information
Enter an SQL statement in the query box to query the information you need, for example:
As shown above, you can see the disk usage information of the server.
The above is the basic introduction and Installation Method of telegraf. For more information, see the official documentation...
Real-time data monitoring platform (2): Introduction and installation of telegraf