Erro when I try to start Telegraf after install it, on Ubuntu Server 22.04

Hi, I’m trying to install Telegraf on Ubuntu Server 22.04 minimal. But I’m getting an error when I try to start Telegraf.

After installation I am giving the following command

systemctl start telegraf

After giving the start command this error appears

Job for telegraf.service failed because the control process exited with error code.
See “systemctl status telegraf.service” and “journalctl -xeu telegraf.service” for details.

When I check the status of Telegraf

ubuntu@mot-x:~$ systemctl status telegraf
× telegraf.service - Telegraf
Loaded: loaded (/lib/systemd/system/telegraf.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2024-02-22 10:46:06 UTC; 50min ago
Docs: GitHub - influxdata/telegraf: The plugin-driven server agent for collecting & reporting metrics.
Process: 11487 ExecStart=/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d $TELEGRA
F_OPTS (code=exited, status=1/FAILURE)
Main PID: 11487 (code=exited, status=1/FAILURE)
CPU: 277ms

Feb 22 10:46:06 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 5.
Feb 22 10:46:06 mot-x systemd[1]: Stopped Telegraf.
Feb 22 10:46:06 mot-x systemd[1]: telegraf.service: Start request repeated too quickly.
Feb 22 10:46:06 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 10:46:06 mot-x systemd[1]: Failed to start Telegraf.

This does not happen on ARM architecture, only on AMD64

Any help will be greatly appreciated

Hi,

Those logs unfortunately do not provide enough information about what is going on. Please view the full logs by running:

journalctl --no-pager --unit telegraf

Thanks for helping, this a part of the file. It is to big to post here

root@mot-x:/home/ubuntu# journalctl --no-pager --unit telegraf
Feb 22 01:46:59 mot-x systemd[1]: /lib/systemd/system/telegraf.service:12: Unknown key name ‘ImportCredential’ in section ‘Service’, ignoring.
Feb 22 01:47:00 mot-x systemd[1]: /lib/systemd/system/telegraf.service:12: Unknown key name ‘ImportCredential’ in section ‘Service’, ignoring.
Feb 22 01:48:05 mot-x systemd[1]: /lib/systemd/system/telegraf.service:12: Unknown key name ‘ImportCredential’ in section ‘Service’, ignoring.
Feb 22 01:49:18 mot-x systemd[1]: /lib/systemd/system/telegraf.service:12: Unknown key name ‘ImportCredential’ in section ‘Service’, ignoring.
Feb 22 01:49:19 mot-x systemd[1]: Starting Telegraf…
Feb 22 01:49:20 mot-x telegraf[19510]: 2024-02-22T01:49:20Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 01:49:20 mot-x telegraf[19510]: 2024-02-22T01:49:20Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 01:49:20 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 01:49:20 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:49:20 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 01:49:20 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 1.
Feb 22 01:49:20 mot-x systemd[1]: Stopped Telegraf.
Feb 22 01:49:20 mot-x systemd[1]: Starting Telegraf…
Feb 22 01:49:20 mot-x telegraf[19518]: 2024-02-22T01:49:20Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 01:49:20 mot-x telegraf[19518]: 2024-02-22T01:49:20Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 01:49:20 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 01:49:20 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:49:20 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 01:49:20 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 2.
Feb 22 01:49:20 mot-x systemd[1]: Stopped Telegraf.
Feb 22 01:49:20 mot-x systemd[1]: Starting Telegraf…
Feb 22 01:49:21 mot-x telegraf[19525]: 2024-02-22T01:49:21Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 01:49:21 mot-x telegraf[19525]: 2024-02-22T01:49:21Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 01:49:21 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 01:49:21 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:49:21 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 01:49:21 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 3.
Feb 22 01:49:21 mot-x systemd[1]: Stopped Telegraf.
Feb 22 01:49:21 mot-x systemd[1]: Starting Telegraf…
Feb 22 01:49:21 mot-x telegraf[19532]: 2024-02-22T01:49:21Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 01:49:21 mot-x telegraf[19532]: 2024-02-22T01:49:21Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 01:49:21 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 01:49:21 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:49:21 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 01:49:21 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 4.
Feb 22 01:49:21 mot-x systemd[1]: Stopped Telegraf.
Feb 22 01:49:21 mot-x systemd[1]: Starting Telegraf…
Feb 22 01:49:22 mot-x telegraf[19539]: 2024-02-22T01:49:22Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 01:49:22 mot-x telegraf[19539]: 2024-02-22T01:49:22Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 01:49:22 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 01:49:22 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:49:22 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 01:49:22 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 5.
Feb 22 01:49:22 mot-x systemd[1]: Stopped Telegraf.
Feb 22 01:49:22 mot-x systemd[1]: telegraf.service: Start request repeated too quickly.
Feb 22 01:49:22 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:49:22 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 01:51:11 mot-x systemd[1]: /lib/systemd/system/telegraf.service:12: Unknown key name ‘ImportCredential’ in section ‘Service’, ignoring.
Feb 22 01:55:14 mot-x systemd[1]: /lib/systemd/system/telegraf.service:12: Unknown key name ‘ImportCredential’ in section ‘Service’, ignoring.
Feb 22 01:55:15 mot-x systemd[1]: /lib/systemd/system/telegraf.service:12: Unknown key name ‘ImportCredential’ in section ‘Service’, ignoring.
– Boot f43c2936967a41c68039a642771f77da –
Feb 22 01:57:17 mot-x systemd[1]: Starting Telegraf…
Feb 22 01:57:21 mot-x telegraf[619]: 2024-02-22T01:57:21Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 01:57:21 mot-x telegraf[619]: 2024-02-22T01:57:21Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 01:57:21 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 01:57:21 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:57:21 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 01:57:21 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 1.
Feb 22 01:57:21 mot-x systemd[1]: Stopped Telegraf.
Feb 22 01:57:21 mot-x systemd[1]: Starting Telegraf…
Feb 22 01:57:22 mot-x telegraf[704]: 2024-02-22T01:57:22Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 01:57:22 mot-x telegraf[704]: 2024-02-22T01:57:22Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 01:57:22 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 01:57:22 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:57:22 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 01:57:22 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 2.
Feb 22 01:57:22 mot-x systemd[1]: Stopped Telegraf.
Feb 22 01:57:22 mot-x systemd[1]: Starting Telegraf…
Feb 22 01:57:22 mot-x telegraf[711]: 2024-02-22T01:57:22Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 01:57:22 mot-x telegraf[711]: 2024-02-22T01:57:22Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 01:57:23 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 01:57:23 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:57:23 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 01:57:23 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 3.
Feb 22 01:57:23 mot-x systemd[1]: Stopped Telegraf.
Feb 22 01:57:23 mot-x systemd[1]: Starting Telegraf…
Feb 22 01:57:24 mot-x telegraf[720]: 2024-02-22T01:57:24Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 01:57:24 mot-x telegraf[720]: 2024-02-22T01:57:24Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 01:57:24 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 01:57:24 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:57:24 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 01:57:24 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 4.
Feb 22 01:57:24 mot-x systemd[1]: Stopped Telegraf.
Feb 22 01:57:24 mot-x systemd[1]: Starting Telegraf…
Feb 22 01:57:24 mot-x telegraf[739]: 2024-02-22T01:57:24Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 01:57:24 mot-x telegraf[739]: 2024-02-22T01:57:24Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 01:57:24 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 01:57:24 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:57:24 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 01:57:25 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 5.
Feb 22 01:57:25 mot-x systemd[1]: Stopped Telegraf.
Feb 22 01:57:25 mot-x systemd[1]: telegraf.service: Start request repeated too quickly.
Feb 22 01:57:25 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 01:57:25 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 02:05:24 mot-x systemd[1]: /lib/systemd/system/telegraf.service:12: Unknown key name ‘ImportCredential’ in section ‘Service’, ignoring.
Feb 22 02:05:24 mot-x systemd[1]: Starting Telegraf…
Feb 22 02:05:25 mot-x telegraf[1029]: 2024-02-22T02:05:25Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 02:05:25 mot-x telegraf[1029]: 2024-02-22T02:05:25Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 02:05:25 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 02:05:25 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 02:05:25 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 02:05:25 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 1.
Feb 22 02:05:25 mot-x systemd[1]: Stopped Telegraf.
Feb 22 02:05:25 mot-x systemd[1]: Starting Telegraf…
Feb 22 02:05:25 mot-x telegraf[1036]: 2024-02-22T02:05:25Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 02:05:25 mot-x telegraf[1036]: 2024-02-22T02:05:25Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 02:05:25 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 02:05:25 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 02:05:25 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 02:05:25 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 2.
Feb 22 02:05:25 mot-x systemd[1]: Stopped Telegraf.
Feb 22 02:05:25 mot-x systemd[1]: Starting Telegraf…
Feb 22 02:05:26 mot-x telegraf[1043]: 2024-02-22T02:05:26Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 02:05:26 mot-x telegraf[1043]: 2024-02-22T02:05:26Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 02:05:26 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 02:05:26 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 02:05:26 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 02:05:26 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 3.
Feb 22 02:05:26 mot-x systemd[1]: Stopped Telegraf.
Feb 22 02:05:26 mot-x systemd[1]: Starting Telegraf…
Feb 22 02:05:26 mot-x telegraf[1051]: 2024-02-22T02:05:26Z I! Loading config: /etc/telegraf/telegraf.conf
Feb 22 02:05:26 mot-x telegraf[1051]: 2024-02-22T02:05:26Z E! [telegraf] Error running agent: no outputs found, did you provide a valid config file?
Feb 22 02:05:26 mot-x systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
Feb 22 02:05:26 mot-x systemd[1]: telegraf.service: Failed with result ‘exit-code’.
Feb 22 02:05:26 mot-x systemd[1]: Failed to start Telegraf.
Feb 22 02:05:26 mot-x systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 4.

Here is why it has not started. Doesn’t sound like you provided any details in your config as to where to output data to.

I just larning how to create the config file. Many thanks for your help Its up an runing now :slight_smile:

Have a look

● telegraf.service - Telegraf
Loaded: loaded (/lib/systemd/system/telegraf.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2024-02-22 15:08:21 UTC; 10s ago
Docs: GitHub - influxdata/telegraf: The plugin-driven server agent for collecting & reporting metrics.
Main PID: 2010 (telegraf)
Tasks: 7 (limit: 1067)
Memory: 29.7M
CPU: 306ms
CGroup: /system.slice/telegraf.service
└─2010 /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d

Feb 22 15:08:21 mot-x telegraf[2010]: 2024-02-22T15:08:21Z I! Starting Telegraf 1.29.5 brought to you by InfluxData the makers of InfluxDB
Feb 22 15:08:21 mot-x telegraf[2010]: 2024-02-22T15:08:21Z I! Available plugins: 241 inputs, 9 aggregators, 30 processors, 24 parsers, 60 outputs, 6 secret-stores
Feb 22 15:08:21 mot-x telegraf[2010]: 2024-02-22T15:08:21Z I! Loaded inputs: system
Feb 22 15:08:21 mot-x telegraf[2010]: 2024-02-22T15:08:21Z I! Loaded aggregators:
Feb 22 15:08:21 mot-x telegraf[2010]: 2024-02-22T15:08:21Z I! Loaded processors:
Feb 22 15:08:21 mot-x telegraf[2010]: 2024-02-22T15:08:21Z I! Loaded secretstores:
Feb 22 15:08:21 mot-x telegraf[2010]: 2024-02-22T15:08:21Z I! Loaded outputs: influxdb_v2
Feb 22 15:08:21 mot-x telegraf[2010]: 2024-02-22T15:08:21Z I! Tags enabled: host=mot-x
Feb 22 15:08:21 mot-x telegraf[2010]: 2024-02-22T15:08:21Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:“mot-x”, Flush Interval:10s
Feb 22 15:08:21 mot-x systemd[1]: Started Telegraf.
root@mot-x:/etc/telegraf#

I’m sorry, I’m new on TIG stack

If anyone have the same problem this a nice tutorial on how to make a conf file

Many thanks Have a nice day

1 Like

pls you your conf file data to these data and take restart telegraf.

[global_tags]
[agent]
interval = “60s”
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = “0s”
flush_interval = “30s”
flush_jitter = “0s”
precision = “”
debug = false
quiet = false
logfile = “/var/log/telegraf/telegraf.log”
hostname = “”
omit_hostname = false
[[outputs.influxdb]]
urls = [“http://127.0.0.1:8086”]
database = “telegraf”
retention_policy = “”
write_consistency = “any”
timeout = “5s”
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
[[inputs.disk]]
ignore_fs = [“tmpfs”, “devtmpfs”]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]

[[inputs.apache]]
urls = [“http://127.0.0.1/server-status?auto”]

[[inputs.mysql]]
servers = [“graphite:s3cretshop@tcp(127.0.0.1:3306)/”]
gather_process_list = true
gather_info_schema_auto_inc = true
gather_slave_status = true
gather_binary_logs = false
interval_slow = “5m”