How to add additional plugins

First time I’ve used Telegraf, so sorry if it’s a basic question.

I installed Telegraf v1.26.0 on a Oracle Cloud server with Ubuntu, using the official install/setup guide, and setup the initial config by running telegraf --sample-config --input-filter cpu:mem:disk --output-filter influxdb_v2 > telegraf.conf which worked OK, and I can see the data arriving in Influx.

However, I wanted to add another plugin - [[outputs.mqtt]], so I copied the plugin conf from the git repo and pasted it into the telegraf.conf file, adding my mqtt server details.
I then restarted telegraf but it would not run, until I removed the section that I added.

I’ve read the guide, but cannot understand what the correct way is to add additional plugins in an already working system.

In /etc/telegraf, I have;

root@server-a:/etc/telegraf# ls
telegraf.conf  telegraf.conf.sample  telegraf.d

There is nothing in telegraf.d

First of all, copying the configuration from the git repository should work if your Telegraf version isn’t too old (which is not the case for you). So you might want to check the error message in the log. Often there are some misspellings or syntax errors.

Thanks @srebhan you are correct, although I checked it before posting, I’ve rechecked and found a copy/paste error.
All good now!

Thanks