Telegraf not working after boot

I am using two telegraf services running on my rpi, but they stop working every time my rpi boots. If I load the token and telegraf cofiguration after boot it will all work fine until next reboot. I checked this thread Telegraf failed to start after reboot, and my telegraf service already shows *** network-online.target`as in the solution for that thread.

not sure if this is the log file for troubleshooting, but here is part of it.

Apr 03 09:33:03 Octopi systemd[1]: Starting Telegraf…
Apr 03 09:33:31 Octopi telegraf[1238]: 2024-04-03T13:33:31Z I! Loading config: /etc/telegraf/telegraf.conf
Apr 03 09:33:32 Octopi telegraf[1238]: 2024-04-03T13:33:32Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Apr 03 09:33:32 Octopi systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Apr 03 09:33:32 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Apr 03 09:33:32 Octopi systemd[1]: Failed to start Telegraf.
Apr 03 09:33:32 Octopi systemd[1]: telegraf.service: Consumed 1.757s CPU time.
Apr 03 09:33:32 Octopi systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 1.
Apr 03 09:33:32 Octopi systemd[1]: Stopped Telegraf.
Apr 03 09:33:32 Octopi systemd[1]: telegraf.service: Consumed 1.757s CPU time.
Apr 03 09:33:32 Octopi systemd[1]: Starting Telegraf…
Apr 03 09:33:33 Octopi telegraf[1702]: 2024-04-03T13:33:33Z I! Loading config: /etc/telegraf/telegraf.conf
Apr 03 09:33:33 Octopi telegraf[1702]: 2024-04-03T13:33:33Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Apr 03 09:33:33 Octopi systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Apr 03 09:33:33 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Apr 03 09:33:33 Octopi systemd[1]: Failed to start Telegraf.
Apr 03 09:33:34 Octopi systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 2.
Apr 03 09:33:34 Octopi systemd[1]: Stopped Telegraf.
Apr 03 09:33:34 Octopi systemd[1]: Starting Telegraf…
Apr 03 09:33:35 Octopi telegraf[1754]: 2024-04-03T13:33:35Z I! Loading config: /etc/telegraf/telegraf.conf
Apr 03 09:33:36 Octopi telegraf[1754]: 2024-04-03T13:33:36Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Apr 03 09:33:36 Octopi systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Apr 03 09:33:36 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Apr 03 09:33:36 Octopi systemd[1]: Failed to start Telegraf.
Apr 03 09:33:36 Octopi systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 3.
Apr 03 09:33:36 Octopi systemd[1]: Stopped Telegraf.
Apr 03 09:33:36 Octopi systemd[1]: Starting Telegraf…
Apr 03 09:33:38 Octopi telegraf[1847]: 2024-04-03T13:33:38Z I! Loading config: /etc/telegraf/telegraf.conf
Apr 03 09:33:38 Octopi telegraf[1847]: 2024-04-03T13:33:38Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Apr 03 09:33:38 Octopi systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Apr 03 09:33:38 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Apr 03 09:33:38 Octopi systemd[1]: Failed to start Telegraf.
Apr 03 09:33:38 Octopi systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 4.
Apr 03 09:33:38 Octopi systemd[1]: Stopped Telegraf.
Apr 03 09:33:38 Octopi systemd[1]: Starting Telegraf…
Apr 03 09:33:39 Octopi telegraf[1902]: 2024-04-03T13:33:39Z I! Loading config: /etc/telegraf/telegraf.conf
Apr 03 09:33:39 Octopi telegraf[1902]: 2024-04-03T13:33:39Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Apr 03 09:33:39 Octopi systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Apr 03 09:33:39 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Apr 03 09:33:39 Octopi systemd[1]: Failed to start Telegraf.
Apr 03 09:33:39 Octopi systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 5.
Apr 03 09:33:39 Octopi systemd[1]: Stopped Telegraf.
Apr 03 09:33:40 Octopi systemd[1]: Starting Telegraf…
Apr 03 09:33:41 Octopi telegraf[1935]: 2024-04-03T13:33:41Z I! Loading config: /etc/telegraf/telegraf.conf
Apr 03 09:33:41 Octopi telegraf[1935]: 2024-04-03T13:33:41Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Apr 03 09:33:41 Octopi systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Apr 03 09:33:41 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Apr 03 09:33:41 Octopi systemd[1]: Failed to start Telegraf.
Apr 03 09:33:41 Octopi systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 6.
Apr 03 09:33:41 Octopi systemd[1]: Stopped Telegraf.
Apr 03 09:33:41 Octopi systemd[1]: telegraf.service: Start request repeated too quickly.
Apr 03 09:33:41 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Apr 03 09:33:41 Octopi systemd[1]: Failed to start Telegraf.
Apr 03 16:59:42 Octopi systemd[1]: /lib/systemd/system/telegraf.service:12: Unknown key name ‘ImportCredential’ in section ‘Service’, ignoring.

thanks in advance for any help.

Hello @asinclado,
Can you please share your telegraf config as well?
Can you also please set debug=true in the telegraf agent (or alternatively --debug)?
Also its useful to use the --once and --test flags for telegraf.
Also does this look useful to you? https://github.com/influxdata/telegraf/issues/14466

– Boot af33a5dbb9b34533834577540e237459 –
Apr 04 23:58:32 Octopi systemd[1]: Starting Telegraf…
Apr 04 23:59:31 Octopi telegraf[776]: 2024-04-05T03:59:31Z I! Loading config: /e tc/telegraf/telegraf.conf
Apr 04 23:59:31 Octopi telegraf[776]: 2024-04-05T03:59:31Z E! [telegraf] Error r unning agent: no outputs found, did you provide a valid config file?
Apr 04 23:59:31 Octopi systemd[1]: telegraf.service: Main process exited, code=e xited, status=1/FAILURE
Apr 04 23:59:31 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-co de’.
Apr 04 23:59:31 Octopi systemd[1]: Failed to start Telegraf.
Apr 04 23:59:31 Octopi systemd[1]: telegraf.service: Consumed 1.062s CPU time.
Apr 04 23:59:31 Octopi systemd[1]: telegraf.service: Scheduled restart job, rest art counter is at 1.
Apr 04 23:59:31 Octopi systemd[1]: Stopped Telegraf.
Apr 04 23:59:31 Octopi systemd[1]: telegraf.service: Consumed 1.062s CPU time.
Apr 04 23:59:31 Octopi systemd[1]: Starting Telegraf…
Apr 04 23:59:31 Octopi telegraf[1217]: 2024-04-05T03:59:31Z I! Loading config: / etc/telegraf/telegraf.conf
Apr 04 23:59:31 Octopi telegraf[1217]: 2024-04-05T03:59:31Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Apr 04 23:59:31 Octopi systemd[1]: telegraf.service: Main process exited, code=e xited, status=1/FAILURE
Apr 04 23:59:31 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-co de’.
Apr 04 23:59:31 Octopi systemd[1]: Failed to start Telegraf.
Apr 04 23:59:32 Octopi systemd[1]: telegraf.service: Scheduled restart job, rest art counter is at 2.
Apr 04 23:59:32 Octopi systemd[1]: Stopped Telegraf.
Apr 04 23:59:32 Octopi systemd[1]: Starting Telegraf…
Apr 04 23:59:32 Octopi telegraf[1231]: 2024-04-05T03:59:32Z I! Loading config: / etc/telegraf/telegraf.conf
Apr 04 23:59:32 Octopi telegraf[1231]: 2024-04-05T03:59:32Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Apr 04 23:59:32 Octopi systemd[1]: telegraf.service: Main process exited, code=e xited, status=1/FAILURE
Apr 04 23:59:32 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-co de’.
Apr 04 23:59:32 Octopi systemd[1]: Failed to start Telegraf.
Apr 04 23:59:32 Octopi systemd[1]: telegraf.service: Scheduled restart job, rest art counter is at 3.
Apr 04 23:59:32 Octopi systemd[1]: Stopped Telegraf.
Apr 04 23:59:32 Octopi systemd[1]: Starting Telegraf…
Apr 04 23:59:33 Octopi telegraf[1249]: 2024-04-05T03:59:33Z I! Loading config: / etc/telegraf/telegraf.conf
Apr 04 23:59:33 Octopi telegraf[1249]: 2024-04-05T03:59:33Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Apr 04 23:59:33 Octopi systemd[1]: telegraf.service: Main process exited, code=e xited, status=1/FAILURE
Apr 04 23:59:33 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-co de’.
Apr 04 23:59:33 Octopi systemd[1]: Failed to start Telegraf.
Apr 04 23:59:33 Octopi systemd[1]: telegraf.service: Scheduled restart job, rest art counter is at 4.
Apr 04 23:59:33 Octopi systemd[1]: Stopped Telegraf.
Apr 04 23:59:33 Octopi systemd[1]: Starting Telegraf…
Apr 04 23:59:34 Octopi telegraf[1257]: 2024-04-05T03:59:34Z I! Loading config: / etc/telegraf/telegraf.conf
Apr 04 23:59:34 Octopi systemd[1]: telegraf.service: Main process exited, code=e xited, status=1/FAILURE
Apr 04 23:59:37 Octopi telegraf[1257]: 2024-04-05T03:59:34Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Apr 04 23:59:34 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-co de’.
Apr 04 23:59:37 Octopi telegraf[1267]: 2024-04-05T03:59:35Z I! Loading config: / etc/telegraf/telegraf.conf
Apr 04 23:59:37 Octopi telegraf[1267]: 2024-04-05T03:59:35Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Apr 04 23:59:34 Octopi systemd[1]: Failed to start Telegraf.
Apr 04 23:59:34 Octopi systemd[1]: telegraf.service: Scheduled restart job, rest art counter is at 5.
Apr 04 23:59:34 Octopi systemd[1]: Stopped Telegraf.
Apr 04 23:59:34 Octopi systemd[1]: Starting Telegraf…
Apr 04 23:59:35 Octopi systemd[1]: telegraf.service: Main process exited, code=e xited, status=1/FAILURE
Apr 04 23:59:35 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-co de’.
Apr 04 23:59:35 Octopi systemd[1]: Failed to start Telegraf.
Apr 04 23:59:35 Octopi systemd[1]: telegraf.service: Scheduled restart job, rest art counter is at 6.
Apr 04 23:59:35 Octopi systemd[1]: Stopped Telegraf.
Apr 04 23:59:35 Octopi systemd[1]: telegraf.service: Start request repeated too quickly.
Apr 04 23:59:35 Octopi systemd[1]: telegraf.service: Failed with result ‘exit-co de’.
Apr 04 23:59:35 Octopi systemd[1]: Failed to start Telegraf.

sorry it took me a while. I just checked back and didn’t realized i didn;t post my config file. I am being limited by the number of characters in it, so I just uploaded it. MQTT Telegraf token.txt (364 Bytes) hopefully it works