Ala*_*ere 14 plugins install telegraf
我是Telegraf的初学者,我想安装一个"输入插件".我有配置和.go文件但我不知道如何处理它,即使在Google上搜索后也是如此.
先感谢您 !
Telegraf东西安装在/ etc / telegraf文件夹中,默认配置文件是/etc/telegraf/telegraf.conf。
在此文件中,您可以定义输入和输出插件。有关更多信息或在文件内,请参阅Telegraf文档(该文件是在安装Telegraf时免费创建的)。
还有另一个文件夹:/etc/telegraf/telegraf.d
如果您在其中放置任何自定义配置文件,Telegraf会选择它,它将帮助您更好地构建conf文件。
因此,就我而言,我拥有默认的/etc/telegraf/telegraf.conf文件,并且还在/etc/telegraf/telegraf.d文件夹中创建了另外两个conf文件。
/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
Run Code Online (Sandbox Code Playgroud)
在我的情况下,要启用例如[[inputs.procstat]]的插件:
我有以下几行:
[[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
Run Code Online (Sandbox Code Playgroud)
同样,对于[[inputs.exec]]插件,我还有另一个文件。例如:您可以在[[inputs.exec]]示例中引用此链接。
之后,只需执行以下操作:
$ sudo service telegraf restart; sleep 2
$ sudo service telegraf status
$ tail -f /var/log/telegraf/telegraf.log
Run Code Online (Sandbox Code Playgroud)
另请参阅此帖子:如何向Telegraf添加插件?