Telegraf: getting config in output

Hi,

I am developing an output plugin.

I need to access the configuration from the output. So, I am doing the following:

c := config.NewConfig()

err := c.LoadConfig(“/etc/telegraf/telegraf.conf”)
if err != nil {
log.Printf(“I! error reading configfile”)
}
err = c.LoadDirectory(“/etc/telegraf/conf.d/”)
if err != nil {
log.Printf(“I! error reading configdir”)
}

but the err := c.LoadConfig(“/etc/telegraf/telegraf.conf”) fails. It does not return any err. But the agent enters in loop and tries to load the config again and again.

Any help will highly appreciated.

Regards,

When writing an output you should only use the options for the current output. What other option are you trying to get at?

thanks for your reply. I understood what I was doing wrong.