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).
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?