Telegraf is installed in the / etc / telegraf folder, and the default configuration file is /etc/telegraf/telegraf.conf .
Inside this file you can define input and output plugins. See the Telegraf Document for more or inside the file (which is created for you free of charge by installing Telegraf).
There is another folder: /etc/telegraf/telegraf.d
If you place any custom configuration files there, Telegraf will select it and this will help you better structure your conf files.
So, in my case, I have the default /etc/telegraf/telegraf.conf file, and I also created two other conf files inside the /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 the plugin, for example [[inputs.procstat]] , in my case:
I have the following lines:
[[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 the plugin [[inputs.exec]] I have another file. For example: you can link to this link for an example [[inputs.exec]].
After that, just do:
$ sudo service telegraf restart; sleep 2 $ sudo service telegraf status $ tail -f /var/log/telegraf/telegraf.log
Also refer to this post: How to add a plugin to Telegraf?
source share