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 !
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?
You can get more information about creating plugins for Telegraf over here:
https://github.com/influxdata/telegraf/blob/master/CONTRIBUTING.md
Currently you will have to get the telegraf
code from the git and re-compile it with your plugin to make your plugin work. After writing your plugin code, make sure you include it to the telegraf/plugin/inputs/all/all.go
file and then make the new telegraf binary file.
© 2022 - 2024 — McMap. All rights reserved.