本文介绍了Telegraf测试输入和输出插件错误多个conf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Telegraf版本: Telegraf v1.0.1

Telegraf version: Telegraf v1.0.1

我有以下文件:

/etc/telegraf/telegraf.conf

主配置文件(在安装telegraf时免费创建/获取).此文件中没有任何 [[output.< plugin>]] 节,但确实启用了有效的默认 inputs.xx 插件.

main config file (which you create/get for free while installing telegraf). This file doesn't have any [[output.<plugin>]] stanza in it but does have valid default inputs.xx plugins enabled.

/etc/telegraf/telegraf.d/1-company-output-plugin.conf

(此文件具有有效的 outputs.< pluginname> 插件).

(This file has valid outputs.<pluginname> plugin).

/etc/telegraf/telegraf.d/telegraf-additional-inputs-plugins.conf

(此文件还有其他 inputs.< pluginname> 插件,我想与主conf文件分开).

(this file has additional inputs.<pluginname> plugins that I want to keep separate from the main conf file).


运行 sudo服务telegraf状态表示Telegraf正在运行[确定]!和日志文件/var/log/telegrag/telegraf.log(看起来也不错,没有显示任何错误).


Running sudo service telegraf status shows Telegraf is running [OK]! and log file /var/log/telegrag/telegraf.log (looks good too without showing any errors).

如果我对上述配置文件之一进行了任何更改,我想测试所做的更改(在重新启动telegraf之前),因此我将使用 -test -test 选项,但出现以下错误:

If I make any changes to one of the above configuration files, I want to test those changes made (before I restart telegraf), so I'm running the following commands with -test or --test option but I'm getting the following error:

ubuntu@jenkins:~/test_aks_dir$ telegraf --config /etc/telegraf/telegraf.conf -test
2017/01/10 22:45:48 E! Error: no outputs found, did you provide a valid config file?
ubuntu@jenkins:~/test_aks_dir$ telegraf --config /etc/telegraf/telegraf.conf --test
2017/01/10 22:45:51 E! Error: no outputs found, did you provide a valid config file?

如您在上面看到的,两个optons -test -test 都起作用,但上面也给出了 valid 错误消息.

As you see above, both optons -test or --test worked but also gave a valid error message above.

由于上述错误是由于没有为 [[outputs.< plugin>]] 提供任何配置节,因此我为包含输出插件节的文件提供了另一个--config文件参数,但现在它为缺少的输入提供了一个错误.文件:

As the above error was for not providing any configuration stanza for [[outputs.<plugin>]], I provided another --config file paramter for the file which contains the outputs plugin stanza, but now it gave an error for the missing inputs. file:

ubuntu@jenkins:~/test_aks_dir$ telegraf --config /etc/telegraf/telegraf.conf --config /etc/telegraf/telegraf.d/1-company-output-plugin.conf  --test
2017/01/10 22:48:30 E! Error: no inputs found, did you provide a valid config file?
ubuntu@jenkins:~/test_aks_dir$

注意:上面的命令没有错误,因为它提供了多个-config< someConfigFile> 参数值.

Note: The above command didn't error for providing multiple --config <someConfigFile> parameter values.

如果我要测试第3个文件中的任何更改,也会出现相同的错误:(/etc/telegraf/telegraf.d/telegraf-additional-inputs-plugins.conf )

The same error comes if I want to test any change in the 3rd file : (/etc/telegraf/telegraf.d/telegraf-additional-inputs-plugins.conf)

如何使用 telegraf 假设这里有多个文件,测试个人选择性配置文件的更改:/etc/telegraf/telegraf.d/*.conf 吗?

How can I test an individual or selective configuration file changes using telegraf assuming I have multiple files here: /etc/telegraf/telegraf.d/*.conf ?

推荐答案

目前无法实现,唯一的方法是指定整个配置目录

this is not possible at the moment, the only way to do it would be to specify the entire config directory

这篇关于Telegraf测试输入和输出插件错误多个conf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 00:54