You can build customized versions of Telegraf with a specific plugin set using
the custom builder tool or
build-tags.
For build tags, the plugins can be selected either category-wise, i.e.
inputs
, outputs
,processors
, aggregators
and parsers
or
individually, e.g. inputs.modbus
or outputs.influxdb
.
Usually the build tags correspond to the plugin names used in the Telegraf
configuration. To be sure, check the files in the corresponding
plugin/<category>/all
directory. Make sure to include all parsers you intend
to use.
Note: You always need to include the custom
tag when customizing the
build as otherwise all plugins will be selected regardless of other tags.
When using the project's makefile, the build can be customized via the
BUILDTAGS
environment variable containing a comma-separated list of the
selected plugins (or categories) and the custom
tag.
For example
BUILDTAGS="custom,inputs,outputs.influxdb_v2,parsers.json" make
will build a customized Telegraf including all inputs
, the InfluxDB v2
output
and the json
parser.
If you wish to build Telegraf using native go tools, you can use the go build
command with the -tags
option. Specify a comma-separated list of the
selected plugins (or categories) and the custom
tag as argument.
For example
go build -tags "custom,inputs,outputs.influxdb_v2,parsers.json" ./cmd/telegraf
will build a customized Telegraf including all inputs
, the InfluxDB v2
output
and the json
parser.