2021-08-04 05:03:33 +08:00
|
|
|
|
|
|
|
|
# Telegraf
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
[](https://circleci.com/gh/influxdata/telegraf) [](https://hub.docker.com/_/telegraf/)
|
2020-09-16 04:58:04 +08:00
|
|
|
[](https://www.influxdata.com/slack)
|
2015-05-20 13:26:13 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
Telegraf is an agent for collecting, processing, aggregating, and writing metrics. Based on a
|
|
|
|
|
plugin system to enable developers in the community to easily add support for additional
|
|
|
|
|
metric collection. There are four distinct types of plugins:
|
2016-11-04 22:12:22 +08:00
|
|
|
|
2021-09-22 01:39:48 +08:00
|
|
|
1. [Input Plugins](/docs/INPUTS.md) collect metrics from the system, services, or 3rd party APIs
|
|
|
|
|
2. [Processor Plugins](/docs/PROCESSORS.md) transform, decorate, and/or filter metrics
|
|
|
|
|
3. [Aggregator Plugins](/docs/AGGREGATORS.md) create aggregate metrics (e.g. mean, min, max, quantiles, etc.)
|
|
|
|
|
4. [Output Plugins](/docs/OUTPUTS.md) write metrics to various destinations
|
2016-11-04 22:12:22 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
New plugins are designed to be easy to contribute, pull requests are welcomed, and we work to
|
|
|
|
|
incorporate as many pull requests as possible. Consider looking at the
|
|
|
|
|
[list of external plugins](EXTERNAL_PLUGINS.md) as well.
|
2017-05-10 04:44:34 +08:00
|
|
|
|
2019-12-05 09:16:00 +08:00
|
|
|
## Minimum Requirements
|
|
|
|
|
|
|
|
|
|
Telegraf shares the same [minimum requirements][] as Go:
|
2021-10-21 04:05:57 +08:00
|
|
|
|
2019-12-05 09:16:00 +08:00
|
|
|
- Linux kernel version 2.6.23 or later
|
|
|
|
|
- Windows 7 or later
|
|
|
|
|
- FreeBSD 11.2 or later
|
|
|
|
|
- MacOS 10.11 El Capitan or later
|
|
|
|
|
|
|
|
|
|
[minimum requirements]: https://github.com/golang/go/wiki/MinimumRequirements#minimum-requirements
|
|
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
## Obtaining Telegraf
|
|
|
|
|
|
|
|
|
|
View the [changelog](/CHANGELOG.md) for the latest updates and changes by version.
|
|
|
|
|
|
|
|
|
|
### Binary Downloads
|
|
|
|
|
|
|
|
|
|
Binary downloads are available from the [InfluxData downloads](https://www.influxdata.com/downloads)
|
|
|
|
|
page or from each [GitHub Releases](https://github.com/influxdata/telegraf/releases) page.
|
2015-05-20 13:26:13 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
### Package Repository
|
2016-03-17 23:53:55 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
InfluxData also provides a package repo that contains both DEB and RPM downloads.
|
2016-01-31 02:53:17 +08:00
|
|
|
|
2021-10-27 21:11:43 +08:00
|
|
|
For deb-based platforms (e.g. Ubuntu and Debian) run the following to add the
|
|
|
|
|
repo key and setup a new sources.list entry:
|
2021-10-21 04:05:57 +08:00
|
|
|
|
|
|
|
|
```shell
|
2021-10-27 21:11:43 +08:00
|
|
|
wget -qO- https://repos.influxdata.com/influxdb.key | sudo tee /etc/apt/trusted.gpg.d/influxdb.asc >/dev/null
|
|
|
|
|
source /etc/os-release
|
|
|
|
|
echo "deb https://repos.influxdata.com/${ID} ${VERSION_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
|
|
|
|
|
sudo apt-get update && sudo apt-get install telegraf
|
2021-10-21 04:05:57 +08:00
|
|
|
```
|
|
|
|
|
|
2021-10-27 21:11:43 +08:00
|
|
|
For RPM-based platforms (e.g. RHEL, CentOS) use the following to create a repo
|
|
|
|
|
file and install telegraf:
|
2021-10-21 04:05:57 +08:00
|
|
|
|
2021-10-27 21:11:43 +08:00
|
|
|
```shell
|
|
|
|
|
cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo
|
2021-10-21 04:05:57 +08:00
|
|
|
[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
|
2021-10-27 21:11:43 +08:00
|
|
|
EOF
|
|
|
|
|
sudo yum install telegraf
|
2021-10-21 04:05:57 +08:00
|
|
|
```
|
2016-01-31 02:53:17 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
### Build From Source
|
2015-08-19 00:16:59 +08:00
|
|
|
|
2021-10-19 07:25:03 +08:00
|
|
|
Telegraf requires Go version 1.17 or newer, the Makefile requires GNU make.
|
2017-07-22 02:15:00 +08:00
|
|
|
|
2021-10-19 07:25:03 +08:00
|
|
|
1. [Install Go](https://golang.org/doc/install) >=1.17 (1.17.2 recommended)
|
2020-01-17 06:38:06 +08:00
|
|
|
2. Clone the Telegraf repository:
|
2018-07-25 05:57:24 +08:00
|
|
|
```
|
2020-01-17 06:38:06 +08:00
|
|
|
git clone https://github.com/influxdata/telegraf.git
|
2018-07-25 05:57:24 +08:00
|
|
|
```
|
2020-01-17 06:38:06 +08:00
|
|
|
3. Run `make` from the source directory
|
2018-07-25 05:57:24 +08:00
|
|
|
```
|
2021-10-21 04:05:57 +08:00
|
|
|
cd telegraf
|
2018-07-25 05:57:24 +08:00
|
|
|
make
|
|
|
|
|
```
|
2015-08-19 00:16:59 +08:00
|
|
|
|
2017-08-24 06:42:25 +08:00
|
|
|
### Nightly Builds
|
|
|
|
|
|
2021-09-17 01:22:24 +08:00
|
|
|
[Nightly](/docs/NIGHTLIES.md) builds are available, generated from the master branch.
|
2021-05-13 09:20:04 +08:00
|
|
|
|
2021-09-17 02:14:41 +08:00
|
|
|
### 3rd Party Builds
|
|
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
Builds for other platforms or package formats are provided by members of theTelegraf community.
|
|
|
|
|
These packages are not built, tested, or supported by the Telegraf project or InfluxData. Please
|
|
|
|
|
get in touch with the package author if support is needed:
|
2021-09-17 02:14:41 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
- [Ansible Role](https://github.com/rossmcdonald/telegraf)
|
|
|
|
|
- [Chocolatey](https://chocolatey.org/packages/telegraf) by [ripclawffb](https://chocolatey.org/profiles/ripclawffb)
|
|
|
|
|
- [Scoop](https://github.com/ScoopInstaller/Main/blob/master/bucket/telegraf.json)
|
|
|
|
|
- [Snap](https://snapcraft.io/telegraf) by Laurent Sesquès (sajoupa)
|
2021-09-17 02:14:41 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
## Getting Started
|
2015-06-20 09:53:35 +08:00
|
|
|
|
2016-10-25 20:47:38 +08:00
|
|
|
See usage with:
|
2016-01-08 06:21:10 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
```shell
|
2018-09-18 02:45:08 +08:00
|
|
|
telegraf --help
|
2016-10-25 20:47:38 +08:00
|
|
|
```
|
2016-01-08 06:21:10 +08:00
|
|
|
|
2017-01-14 01:02:10 +08:00
|
|
|
#### Generate a telegraf config file:
|
2016-01-08 06:21:10 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
```shell
|
2018-09-18 02:45:08 +08:00
|
|
|
telegraf config > telegraf.conf
|
2016-10-25 20:47:38 +08:00
|
|
|
```
|
2016-01-08 06:21:10 +08:00
|
|
|
|
2017-08-04 02:54:05 +08:00
|
|
|
#### Generate config with only cpu input & influxdb output plugins defined:
|
2016-10-05 20:53:43 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
```shell
|
2020-02-05 05:54:11 +08:00
|
|
|
telegraf --section-filter agent:inputs:outputs --input-filter cpu --output-filter influxdb config
|
2016-10-25 20:47:38 +08:00
|
|
|
```
|
2016-01-08 06:21:10 +08:00
|
|
|
|
2020-05-14 15:41:58 +08:00
|
|
|
#### Run a single telegraf collection, outputting metrics to stdout:
|
2016-01-08 06:21:10 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
```shell
|
2018-09-18 02:45:08 +08:00
|
|
|
telegraf --config telegraf.conf --test
|
2016-10-25 20:47:38 +08:00
|
|
|
```
|
2016-01-08 06:21:10 +08:00
|
|
|
|
2017-08-04 02:54:05 +08:00
|
|
|
#### Run telegraf with all plugins defined in config file:
|
2016-01-08 06:21:10 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
```shell
|
2018-09-18 02:45:08 +08:00
|
|
|
telegraf --config telegraf.conf
|
2016-10-25 20:47:38 +08:00
|
|
|
```
|
2016-01-08 06:21:10 +08:00
|
|
|
|
2017-08-04 02:54:05 +08:00
|
|
|
#### Run telegraf, enabling the cpu & memory input, and influxdb output plugins:
|
2016-01-08 06:21:10 +08:00
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
```shell
|
2018-09-18 02:45:08 +08:00
|
|
|
telegraf --config telegraf.conf --input-filter cpu:mem --output-filter influxdb
|
2016-10-25 20:47:38 +08:00
|
|
|
```
|
|
|
|
|
|
2018-09-18 02:45:08 +08:00
|
|
|
## Documentation
|
|
|
|
|
|
2021-10-21 04:05:57 +08:00
|
|
|
[Latest Release Documentation](https://docs.influxdata.com/telegraf)
|
2015-05-20 13:26:13 +08:00
|
|
|
|
2021-09-22 01:39:48 +08:00
|
|
|
For documentation on the latest development code see the [documentation index](/docs).
|
2015-12-01 22:15:28 +08:00
|
|
|
|
2021-09-22 01:39:48 +08:00
|
|
|
- [Input Plugins](/docs/INPUTS.md)
|
|
|
|
|
- [Output Plugins](/docs/OUTPUTS.md)
|
|
|
|
|
- [Processor Plugins](/docs/PROCESSORS.md)
|
|
|
|
|
- [Aggregator Plugins](/docs/AGGREGATORS.md)
|
2021-09-21 19:02:13 +08:00
|
|
|
|
|
|
|
|
## Contributing
|
|
|
|
|
|
|
|
|
|
There are many ways to contribute:
|
2021-10-21 04:05:57 +08:00
|
|
|
|
2021-09-21 19:02:13 +08:00
|
|
|
- Fix and [report bugs](https://github.com/influxdata/telegraf/issues/new)
|
|
|
|
|
- [Improve documentation](https://github.com/influxdata/telegraf/issues?q=is%3Aopen+label%3Adocumentation)
|
|
|
|
|
- [Review code and feature proposals](https://github.com/influxdata/telegraf/pulls)
|
|
|
|
|
- Answer questions and discuss here on github and on the [Community Site](https://community.influxdata.com/)
|
|
|
|
|
- [Contribute plugins](CONTRIBUTING.md)
|
2021-09-22 01:39:48 +08:00
|
|
|
- [Contribute external plugins](docs/EXTERNAL_PLUGINS.md)
|