How can I control the metrics collection time precisely?

For example, if i want to collect metrics at the 20th second and the 50 second in each minute, how can I write/modify configuration file?

That’s not possible from within telegraf.

Workaround would be to run telegraf with the --once argument on these specific intervals.

You could also make make sure telegraf is only started at the 20s or 50s mark. (Given interval is set at 30s and no jitter is applied)