1

Telegraf version: Telegraf v1.0.1

I have the following files:

/etc/telegraf/telegraf.conf 

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 

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

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

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


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

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?

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

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$ 

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

The same error comes if I want to test any change in the 3rd file : (/etc/telegraf/telegraf.d/telegraf-additional-inputs-plugins.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 ?

AKS
  • 16,482
  • 43
  • 166
  • 258

1 Answers1

2

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

Cameron Sparr
  • 3,925
  • 2
  • 22
  • 31
  • 1
    Yea, giving `--config-directory /etc/telegraf` works, which I tried already. Would be good if in future, we can just test a single config file otherwise, a user has to `grep` the lines all the time to see what's coming out from a plugin which may exist only in one config file (which is my case). If it's not supported at the moment, then I'm wondering why at command line, I was able to give more than one `--config cccccc` config files and it didn't error out (that makes one believe that telegraf cmd supports individual config files for `-test` or `--test`). – AKS Jan 13 '17 at 18:32
  • I guess `--input-filter=` will help to filter out (other than using `grep`) with `--test` and `--config-directory=/etc/telegraf` command line options. Ex: `telegraf --config-directory=/etc/telegraf --test --input-filter=filestat` – AKS Feb 22 '17 at 07:05