content/telegraf/v1/configure_plugins/external_plugins/shim.md
The shim makes it easy to extract an internal input,
processor, or output plugin from the main Telegraf repo out to a stand-alone repo. This allows anyone to build and run it as a separate app using one of the
execd plugins:
plugins/inputs/cpu in the Telegraf repo, move it to plugins/inputs/cpu
in the new repo.cmd folder.
This serves as the entry point to the plugin when run as a stand-alone program.
{{% note %}}
The shim isn't designed to run multiple plugins at the same time, so include only one plugin per repo.
{{% /note %}}main.go file to import your plugin. For example,_ "github.com/me/my-plugin-telegraf/plugins/inputs/cpu". See an example of where to edit main.go here.cmd/main.go using the following command with your plugin name: go build -o plugin-name cmd/main.goSTDIN. Skip this step if you're building an input../project-name -config plugin.conf).
Metrics will be written to STDOUT. You might need to hit enter or wait for your poll duration to elapse to see data.Ctrl-C to end your test.[[inputs.execd]]
command = ["/path/to/rand", "-config", "/path/to/plugin.conf"]
signal = "none"
Refer to the execd plugin documentation for more information.
Publishing your plugin to GitHub and open a Pull Request back to the Telegraf repo letting us know about the availability of your external plugin.