I am a beginner with Telegraf, and I would like to install an "input plugin". I have the configuration and the .go file but I do not know what to do with it, even after searching on Google.
Thank you in advance !
Telegraf stuff is installed at /etc/telegraf folder and the default configuration file is /etc/telegraf/telegraf. conf. Inside this file, you can define the input and output plugins. See Telegraf doc for more or inside the file (which is created for you for free when you install Telegraf).
Telegraf input plugins are used with the InfluxData time series platform to collect metrics from the system, services, or third party APIs. All metrics are gathered from the inputs you enable and configure in the configuration file.
Telegraf is a plugin-driven agent that collects, processes, aggregates, and writes metrics. It supports four categories of plugins including input, output, aggregator, processor, and external.
Telegraf stuff is installed at /etc/telegraf folder and the default configuration file is /etc/telegraf/telegraf.conf.
Inside this file, you can define the input and output plugins. See Telegraf doc for more or inside the file (which is created for you for free when you install Telegraf).
There's another folder: /etc/telegraf/telegraf.d
If you put any custom configuration files there, Telegraf will pick it and it'll help you in structuring the conf files better.
So, in my case, I have the default /etc/telegraf/telegraf.conf file and I have also created two other conf files inside /etc/telegraf/telegraf.d folder.
/etc/telegraf/telegraf.d folder/myCompany-preferred-output-plugin.conf
/etc/telegraf/telegraf.d folder/myCustom-host-specific-inputs-procstat-plugin.conf
/etc/telegraf/telegraf.d folder/myCustom-inputs-exec-plugin.conf
To enable a plugin for example [[inputs.procstat]] in my case:
I have the following lines in it:
[[inputs.procstat]]
exe = "jenkins"
prefix = "pgrep_serviceprocess"
[[inputs.procstat]]
exe = "telegraf"
prefix = "pgrep_serviceprocess"
[[inputs.procstat]]
exe = "sshd"
prefix = "pgrep_serviceprocess"
[[inputs.procstat]]
exe = "dockerd"
prefix = "pgrep_serviceprocess"
## etc etc
Similarly for [[inputs.exec]] plugin, I have the other file. For ex: You can refer this link for [[inputs.exec]] example.
After that, just do:
$ sudo service telegraf restart; sleep 2
$ sudo service telegraf status
$ tail -f /var/log/telegraf/telegraf.log
Also refer this post: How to add a plugin to Telegraf?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With