# How to put multiple telegraf config files in telegraf.service?

**URL:** <https://community.influxdata.com/t/how-to-put-multiple-telegraf-config-files-in-telegraf-service/22162>\
**Category:** Telegraf\
**Tags:** telegraf, systemd\
**Created:** [October 20, 2021, 5:19pm UTC](https://community.influxdata.com/t/how-to-put-multiple-telegraf-config-files-in-telegraf-service/22162 "2021-10-20T17:19:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pavannayakanti](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/pavannayakanti/32/7951_2.png) [@pavannayakanti](https://community.influxdata.com/u/pavannayakanti)\
**Post date:** [October 20, 2021, 5:19pm UTC](https://community.influxdata.com/t/how-to-put-multiple-telegraf-config-files-in-telegraf-service/22162/1 "2021-10-20T17:19:35Z")

</div>

I have multiple telegraf conf files to schedule using systemd (/usr/lib/systemd/system/telegraf.service)  
but i did not find any provision to put multiple config in one - i mean how to put telegraf1.conf telegraf2.conf, telegraf3.conf in below arguments

ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRAF\_OPTS

Any inputs here?

---

<div class="post-metadata">

**Author:** ![jpowers](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jpowers/32/8569_2.png) [@jpowers](https://community.influxdata.com/u/jpowers)\
**Post date:** [October 20, 2021, 6:45pm UTC](https://community.influxdata.com/t/how-to-put-multiple-telegraf-config-files-in-telegraf-service/22162/2 "2021-10-20T18:45:25Z")

</div>

The preferred way to have multiple configuration files is to store them all under `/etc/telegraf/telegraf.d`. That configuration folder will get read and everything under there loaded when Telegraf runs.

Thanks!

---

<div class="post-metadata">

**Author:** ![pavannayakanti](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/pavannayakanti/32/7951_2.png) [@pavannayakanti](https://community.influxdata.com/u/pavannayakanti)\
**Post date:** [October 21, 2021, 4:55pm UTC](https://community.influxdata.com/t/how-to-put-multiple-telegraf-config-files-in-telegraf-service/22162/3 "2021-10-21T16:55:49Z")

</div>

(post deleted by author)

---

<div class="post-metadata">

**Author:** ![pavannayakanti](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/pavannayakanti/32/7951_2.png) [@pavannayakanti](https://community.influxdata.com/u/pavannayakanti)\
**Post date:** [October 21, 2021, 5:24pm UTC](https://community.influxdata.com/t/how-to-put-multiple-telegraf-config-files-in-telegraf-service/22162/4 "2021-10-21T17:24:46Z")

</div>

thanks @jpowers for your inputs.  
just got curious to know, whether if this works only with influxdb? but my database is postgres. when i check the status of the service, it mentions influxDB explicitely. any insights here?

[root@h0012345 telegraf.d]# systemctl status telegraf  
● telegraf.service - The plugin-driven server agent for **reporting metrics into InfluxDB**  
Loaded: loaded (/usr/lib/systemd/system/telegraf.service; enabled; vendor preset: disabled)  
Active: failed (Result: start-limit) since Thu 2021-10-21 12:18:38 CDT; 1s ago  
Docs: [GitHub - influxdata/telegraf: The plugin-driven server agent for collecting & reporting metrics.](https://github.com/influxdata/telegraf)  
Process: 68859 ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRAF\_OPTS (code=exited, status=1/FAILURE)  
Main PID: 68859 (code=exited, status=1/FAILURE)

Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: Unit telegraf.service entered failed state.  
Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: telegraf.service failed.  
Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: telegraf.service holdoff time over, scheduling restart.  
Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: Stopped The plugin-driven server agent for reporting met…xDB.  
Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: start request repeated too quickly for telegraf.service  
Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: Failed to start The plugin-driven server agent for repor…xDB.  
Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: Unit telegraf.service entered failed state.  
Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: telegraf.service failed.  
Hint: Some lines were ellipsized, use -l to show in full.

---

<div class="post-metadata">

**Author:** ![jpowers](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jpowers/32/8569_2.png) [@jpowers](https://community.influxdata.com/u/jpowers)\
**Post date:** [October 21, 2021, 6:33pm UTC](https://community.influxdata.com/t/how-to-put-multiple-telegraf-config-files-in-telegraf-service/22162/5 "2021-10-21T18:33:57Z")

</div>

> [@pavannayakanti](#):
>
> got curious to know, whether if this works only with influxdb? but my database is postgres. when i check the status of the service, it mentions influxDB explicitely. any insights here?
> 
> [root@h0012345 telegraf.d]# systemctl status telegraf  
> ● telegraf.service - The plugin-driven server agent for **reporting metrics into InfluxDB**  
> Loaded: loaded (/usr/lib/systemd/system/telegraf.service; enabled; vendor preset: disabled)  
> Active: failed (Result: start-limit) since Thu 2021-10-21 12:18:38 CDT; 1s ago  
> Docs: [GitHub - influxdata/telegraf: The plugin-driven server agent for collecting & reporting metrics.](https://github.com/influxdata/telegraf)  
> Process: 68859 ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRAF\_OPTS (code=exited, status=1/FAILURE)  
> Main PID: 68859 (code=exited, status=1/FAILURE)
> 
> Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: Unit telegraf.service entered failed state.  
> Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: telegraf.service failed.  
> Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: telegraf.service holdoff time over, scheduling restart.  
> Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: Stopped The plugin-driven server agent for reporting met…xDB.  
> Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: start request repeated too quickly for telegraf.service  
> Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: Failed to start The plugin-driven server agent for repor…xDB.  
> Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: Unit telegraf.service entered failed state.  
> Oct 21 12:18:38 h0012345.associatesys.local systemd[1]: telegraf.service failed.  
> Hint: Some lines were ellipsized, use -l to show in full.

Your status output shows that Telegraf is looking in the `telegraf.conf.d` directory and for the `telegraf.conf` file. I would check to make sure that the `/etc/telegraf/telegraf.conf` file does not have the InfluxDB output enabled.

Also to get the full un-clipped telegraf logs I like to run: `journalctl -xe --no-pager -u telegraf`
